Write value of a lua variable to an address

Mar 29, 2018
12
2
3
#1
Just messing around with different mono hacking methods, but stuck at this part. I was able to use the mono lua commands to consistently get the base address that I want to use for pointers/other codes. But not able to get that to write to the symbol I made for it.

Thought at first maybe value is not in the correct format but no dice with conversions.

Think I am missing an obvious step. Please point me in the right direction!

Lua:
[ENABLE]
registersymbol(baseaddress)
alloc(baseaddress,64)

baseaddress:
dd 0

{$lua}
images={}
for i=1, #a1 do
  images[i]=mono_getImageFromAssembly(a1[i])

  if mono_image_get_name(images[i])=="Assembly-CSharp" then
    classes=mono_image_enumClasses(images[i])

    for j=1, #classes do
      if classes[j].classname=="GameManager" then
        baseaddress=mono_class_findInstancesOfClassListOnly(d[1],classes[j].class)
        --print(string.format("%.8x",baseaddress[1]))
      end
    end
  end
end

--[[addy=readStringLocal(baseaddy,8)
temp=stringToByteTable(addy)
addy1=byteTableToDword(temp)
--]]
{$asm}

[DISABLE]

unregistersymbol(baseaddress)
dealloc(baseaddress)
 

koderkrazy

Expert Cheater
Fearless Donors
Table Maker
Jun 17, 2018
96
59
18
#2
Hey try this:
Lua:
local myLuaAddr = mono_class_findInstancesOfClassListOnly(d[1],classes[j].class)
writeQword('baseaddress', myLuaAddr)  --if it is 64bit address
   --or writePointer('[baseaddress]', myLuaAddr) if you want to write to address pointed by baseaddress directly
See attached table for example:
1. connect to any process. May be connect to Cheat Engine itself.
2. Load the example table.
3. Run CreateASMVariable script
4. Keep hitting 'Add 5 in Lua' script.
 

Attachments

Mar 29, 2018
12
2
3
#3
Thanks a lot that helped me find what was wrong.

My main problem though is that my lua variable was a table so I needed to add [1] to get the value I wanted.

Knew it was something obvious. Thanks again.
 
Top Bottom