Maybe this would be useful,
function rwmem(Address, SizeOrBuffer)
assert(Address ~= nil, "[rwmem]: error, provided address is nil.")
_rw = {}
if type(SizeOrBuffer) == "number" then
_ = ""
for _ = 1, SizeOrBuffer do _rw[_] = {address = (Address - 1) + _, flags = gg.TYPE_BYTE} end
for v, __ in ipairs(gg.getValues(_rw)) do _ = _ .. string.format("%02X", __.value & 0xFF) end
return _
end
Byte = {} SizeOrBuffer:gsub("..", function(x)
Byte[#Byte + 1] = x _rw[#Byte] = {address = (Address - 1) + #Byte, flags = gg.TYPE_BYTE, value = x .. "h"}
end)
gg.setValues(_rw)
end
-- Usage:
readedMem = rwmem(0xAABBCCDD, 128) -- Read 0xAABBCCDD with 128 size.
rwmem(0xDDCCBBAA, readedMem) -- Write readedMem memory into 0xDDCCBBAA.