Reputation: 1
Have checked the lua documentation and haven't found the function that ouput specific value from the memory address. Is there a function in lua that allows to output the memory address value?
Upvotes: 0
Views: 6302
Reputation: 73
While this doesn't work with nil
, boolean
or number
types, you can use string.format
:
("%p"):format(my_object)
to get a string representation of the memory address of the object behind the variable my_object
in vanilla Lua.
Upvotes: 2
Reputation: 23737
If you are working with LuaJIT, you can create this function yourself (works only on x86-32):
read_memory_dword = require"ffi".cast("__fastcall uint32_t (*)(uint32_t)",
"\x8B\x01\xC3") -- mov EAX,[ECX] / ret
YourValue = read_memory_dword(YourAddress)
Upvotes: 0