{
//luacall call example:
push integervariableyouwishtopasstolua
push addresstostringwithfunction //(The lua function will have access to the variable passed by name "parameter")
call CELUA_ExecuteFunction
//------
//Alternate call by ref example:
mov eax,[addresswithluafunctionidstored]
test eax,eax
jne short hasrefid
push addresswithluafunctionname
call CELUA_GetFunctionReferenceFromName //Basically calls createRef(functionname) and returns the value
mov [addresswithluafunctionidstored],eax
hasrefid:
mov [addresswithparameterlist],param1
mov [addresswithparameterlist+4],param2
mov [addresswithparameterlist+8],param3
//...
push 0 //0=no async, 1=async. Use async if you do not wish to update the GUI. Faster
push addresswithparameterlist
push numberofparameterstopass
push eax //push the reference ID of the function
call CELUA_ExecuteFunctionByReference
When done EAX will contain the result of the lua function
And as per common 32-bit calling convention, EDX and ECX could have been altered. So save/restore them beforehand
}
[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)
newmem: //this is allocated memory, you have read,write,execute access
//place your code here
[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
"PlantsVsZombies.exe"+8728C:
NOP
NOP
//Alt: db 83 47 24 01 8B 47 24