Difference between revisions of "Lua:readBytesLocal"

From Cheat Engine
Jump to navigation Jump to search
m
m
Line 12: Line 12:
 
|-
 
|-
 
|Address
 
|Address
|Integer
+
|Integer or [[CEAddressString]]
 
|The address in Cheat Engine's memory to read from.
 
|The address in Cheat Engine's memory to read from.
 
|-
 
|-

Revision as of 17:11, 11 July 2025

function readBytesLocal(Address, ByteCount, [ReturnAsTable])

Reads bytes from the specified address in Cheat Engine's own process memory (not the target process). Returns the bytes as multiple return values or as a table if ReturnAsTable is true.

Function Parameters

Parameter Type Description
Address Integer or CEAddressString The address in Cheat Engine's memory to read from.
ByteCount Integer The number of bytes to read.
ReturnAsTable Boolean (optional) If true, returns a table of bytes. If false or omitted, returns each byte as a separate return value.

Examples

-- Read 4 bytes and get them as separate values
local b1, b2, b3, b4 = readBytesLocal(0x123456, 4)
print(b1, b2, b3, b4)

-- Read 4 bytes and get them as a table
local bytes = readBytesLocal(0x123456, 4, true)
for i, v in ipairs(bytes) do
  print("Byte " .. i .. ": " .. v)
end

Main Pages

Core Lua documentation entry points

Lua
Script Engine

Related Functions