Posted: Mon Aug 25, 2014 3:24 pm Post subject: Auto Assembler Memory in Lua
I have some data I'd like to back up on [ENABLE] and restore later.
For that I allocate a block in the auto assembler and try to have a Lua function copy the data to my memory. However the symbol apparently isn't registered by the time the Lua function runs (or maybe the memory isn't even allocated yet?) so this test code fails:
Code:
[ENABLE]
alloc(backup, $600)
registersymbol(backup)
LuaCall(copybackup())
[DISABLE]
dealloc(backup)
with "copybackup" being something like:
Code:
function copybackup()
local address = getAddress("backup")
local bytes = readBytes(0xDEADBEEF, 0x600, true)
writeBytes(address, bytes, 0x600)
end
Questions:
Is "backup" even allocated by the time "copybackup" is called?
If so, how do I get an address for "backup"?
If that is impossible how else could I get the job done? Do I have to write my whole script in Lua?
Lua calls are executed before the script is.
You may achieve this by write your whole script in lua, or 2 auto assembler functions.
I'd go for whole script in lua (more options, ordered, can add/update table entries). _________________
I'm rusty and getting older, help me re-learn lua.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum