LUA API v2 MEMORY - xAranaktu/FC-24-Live-Editor GitHub Wiki
MEMORY
Provides access to the process memory.
Fields
This class doesn't have any fields.
Methods
Writing to process memory:
Reading from process memory:
- ReadBytes
- ReadChar
- ReadBool
- ReadShort
- ReadInt
- ReadFloat
- ReadQword
- ReadPointer
- ReadMultilevelPointer
- ReadString
- AOBScanGameModule
- AOBScanRegion
- ResolvePtr
WriteBytes
Writes bytes to process at given memory address May crash your game if the given memory address is invalid
Declaration
bool MEMORY:WriteBytes(unsigned __int64 address, unsigned __int8[] value)
Parameters
Type | Name | Description |
---|---|---|
unsigned __int64 | address | Address where the data should be written |
unsigned __int8[] | value | Array of bytes that should be written to given address |
Returns
Returns true if the data was successfully written
Example
-- MEMORY:WriteBytes
WriteShort
Writes short number to process at given memory address May crash your game if the given memory address is invalid
Declaration
bool MEMORY:WriteShort(unsigned __int64 address, __int16 value)
Parameters
Type | Name | Description |
---|---|---|
unsigned __int64 | address | Address where the data should be written |
__int16 | value | Short int value to write |
Returns
Returns true if the data was successfully written
Example
-- MEMORY:WriteShort
WriteInt
Writes int to process at given memory address May crash your game if the given memory address is invalid
Declaration
bool MEMORY:WriteInt(unsigned __int64 address, __int32 value)
Parameters
Type | Name | Description |
---|---|---|
unsigned __int64 | address | Address where the data should be written |
__int32 | value | Int value to write |
Returns
Returns true if the data was successfully written
Example
-- MEMORY:WriteInt
WriteFloat
Writes float to process at given memory address May crash your game if the given memory address is invalid
Declaration
bool MEMORY:WriteFloat(unsigned __int64 address, float value)
Parameters
Type | Name | Description |
---|---|---|
unsigned __int64 | address | Address where the data should be written |
float | value | float value to write |
Returns
Returns true if the data was successfully written
Example
-- MEMORY:WriteFloat
WriteQword
Writes qword to process at given memory address May crash your game if the given memory address is invalid
Declaration
bool MEMORY:WriteQword(unsigned __int64 address, __int64 value)
Parameters
Type | Name | Description |
---|---|---|
unsigned __int64 | address | Address where the data should be written |
__int64 | value | qword value to write |
Returns
Returns true if the data was successfully written
Example
-- MEMORY:WriteQword
WriteString
Writes string to process at given memory address May crash your game if the given memory address is invalid
Declaration
bool MEMORY:WriteString(unsigned __int64 address, string value)
Parameters
Type | Name | Description |
---|---|---|
unsigned __int64 | address | Address where the data should be written |
string | value | String to write |
Returns
Returns true if the data was successfully written
Example
-- MEMORY:WriteString
ReadBytes
Reads bytes from process at given memory address May crash your game if the given memory address is invalid
Declaration
unsigned __int8[] MEMORY:ReadBytes(unsigned __int64 address, unsigned __int64 count)
Parameters
Type | Name | Description |
---|---|---|
unsigned __int64 | address | Address from where the data should be read |
unsigned __int64 | count | Number of bytes to read |
Returns
Returns unsigned __int8[] (array of bytes) read from the game process.
Example
-- MEMORY:ReadBytes
ReadChar
Reads byte/char from process at given memory address May crash your game if the given memory address is invalid
Declaration
unsigned __int8 MEMORY:ReadChar(unsigned __int64 address)
Parameters
Type | Name | Description |
---|---|---|
unsigned __int64 | address | Address from where the data should be read |
Returns
Returns unsigned __int8 read from the game process.
Example
-- MEMORY:ReadChar
ReadBool
Reads bool from process at given memory address May crash your game if the given memory address is invalid
Declaration
bool MEMORY:ReadBool(unsigned __int64 address)
Parameters
Type | Name | Description |
---|---|---|
unsigned __int64 | address | Address from where the data should be read |
Returns
Returns bool read from the game process.
Example
-- MEMORY:ReadBool
ReadShort
Reads short int from process at given memory address May crash your game if the given memory address is invalid
Declaration
__int16 MEMORY:ReadShort(unsigned __int64 address)
Parameters
Type | Name | Description |
---|---|---|
unsigned __int64 | address | Address from where the data should be read |
Returns
Returns __int16 read from the game process.
Example
-- MEMORY:ReadShort
ReadInt
Reads int from process at given memory address May crash your game if the given memory address is invalid
Declaration
__int32 MEMORY:ReadInt(unsigned __int64 address)
Parameters
Type | Name | Description |
---|---|---|
unsigned __int64 | address | Address from where the data should be read |
Returns
Returns __int32 read from the game process.
Example
-- MEMORY:ReadInt
ReadFloat
Reads float from process at given memory address May crash your game if the given memory address is invalid
Declaration
float MEMORY:ReadFloat(unsigned __int64 address)
Parameters
Type | Name | Description |
---|---|---|
unsigned __int64 | address | Address from where the data should be read |
Returns
Returns float read from the game process.
Example
-- MEMORY:ReadFloat
ReadQword
Reads qword from process at given memory address May crash your game if the given memory address is invalid
Declaration
__int64 MEMORY:ReadQword(unsigned __int64 address)
Parameters
Type | Name | Description |
---|---|---|
unsigned __int64 | address | Address from where the data should be read |
Returns
Returns __int64 read from the game process.
Example
-- MEMORY:ReadQword
ReadPointer
Reads pointer from process at given memory address May crash your game if the given memory address is invalid
Declaration
__int64 MEMORY:ReadPointer(unsigned __int64 address)
Parameters
Type | Name | Description |
---|---|---|
unsigned __int64 | address | Address from where the data should be read |
Returns
Returns __int64 read from the game process.
Example
-- MEMORY:ReadPointer
ReadMultilevelPointer
Reads multi level pointer from process at given memory address May crash your game if the given memory address is invalid
Declaration
__int64 MEMORY:ReadMultilevelPointer(unsigned __int64 address, unsigned __int32[] offsets)
Parameters
Type | Name | Description |
---|---|---|
unsigned __int64 | address | Address from where the data should be read |
unsigned __int32[] | value | Array of offsets |
Returns
Returns __int64 read from the game process.
Example
-- MEMORY:ReadMultilevelPointer
ReadString
Reads string from process at given memory address May crash your game if the given memory address is invalid
Declaration
string MEMORY:ReadString(unsigned __int64 address)
Parameters
Type | Name | Description |
---|---|---|
unsigned __int64 | address | Address from where the data should be read |
Returns
Returns string read from the game process.
Example
-- MEMORY:ReadString
AOBScanGameModule
Performs Array of Bytes scan in game process
Declaration
unsigned __int64 MEMORY:AOBScanGameModule(string pattern)
Parameters
Type | Name | Description |
---|---|---|
string | pattern | AOB pattern as hex. Wildcards are defined by '??' |
Returns
Returns first address matching the pattern as unsigned __int64.
Example
local result = MEMORY:AOBScanGameModule("4C 8B 3D ?? ?? ?? ?? 4D")
LOGGER:LogInfo(string.format("First address matching pattern -> %X", result))
[09:31:28.608] [15948] [DEBUG] [LUA] First address matching pattern -> 146DD5010
AOBScanRegion
Performs Array of Bytes scan in given region
Declaration
unsigned __int64 MEMORY:AOBScanRegion(unsigned __int64 start_address, unsigned __int64 region_size, string pattern)
Parameters
Type | Name | Description |
---|---|---|
unsigned __int64 | start_address | Address from where to start the memory scan |
unsigned __int64 | region_size | Size of the region |
string | pattern | AOB pattern as hex. Wildcards are defined by '??' |
Returns
Returns first address matching the pattern as unsigned __int64.
Example
local result = MEMORY:AOBScanRegion(0x140000000, 0x21CB3000, "4C 8B 3D ?? ?? ?? ?? 4D")
LOGGER:LogInfo(string.format("First address matching pattern -> %X", result))
[09:31:28.608] [15948] [DEBUG] [LUA] First address matching pattern -> 146DD5010
ResolvePtr
Resolve Pointer
Declaration
unsigned __int64 MEMORY:ResolvePtr(unsigned __int64 address, unsigned __int64 start_from)
Parameters
Type | Name | Description |
---|---|---|
unsigned __int64 | address | From where start to resolve |
unsigned __int64 | start_from | Offset where the pointer starts |
Returns
Returns resolved pointer as unsigned __int64.
Example
local result = MEMORY:AOBScanRegion(0x140000000, 0x21CB3000, "4C 8B 3D ?? ?? ?? ?? 4D")
local resolved_ptr = MEMORY:ResolvePtr(result, 3)
LOGGER:LogInfo(string.format("Resolve Pointer -> %X", resolved_ptr))
[09:31:28.608] [15948] [DEBUG] [LUA] Resolve Pointer -> 3740EFF4B0