Lua:autoAssembleCheck

From Cheat Engine
(Redirected from autoAssembleCheck)
Jump to navigation Jump to search

function autoAssembleCheck(AutoAssemblerScript, Enable OPTIONAL, TargetSelf OPTIONAL) : nil - boolean

Checks the script for syntax errors. Returns true on succes, false with an error message on failure.

Tip: Use '[[ ]]' or '[==[ ]==]' quotes for multiline script.

Function Parameters[edit]

Parameter Type Description
AutoAssemblerScript string The script to run with Cheat Engine's auto assembler.
Enable boolean If true the [Enable] section will be checked, else the [Disable] section is checked.
TargetSelf boolean If set it will check as if assembling into Cheat Engine itself.


Examples[edit]

 local checkOk, errMsg = autoAssembleCheck("{$lua}\n print('Checked Form Auto Assembler Script!')")


 local scriptStr = [==[
   alloc(memExample, 0x100)
   label(returnHere)
    
   memExample:
     mov eax,123
     jmp returnHere
    
   00400500:
     jmp memExample
     returnHere:
 ]==]
  
 local checkOk, errMsg = autoAssembleCheck(scriptStr)
 if not checkOk then
   print('The auto assembler script failed.')
   print(errMsg)
 else
   print('The auto assembler script passed.')
 end


 local scriptStr = [==[
   [Enable]
   alloc(memExample, 0x100)
   label(returnHere)
    
   memExample:
     mov eax,123
     jmp returnHere
    
   00400500:
     jmp memExample
     returnHere:
   [Disable]
     dealloc(memExample)
 ]==]
  
 local checkOk, errMsg = autoAssembleCheck(scriptStr, true)
 if not checkOk then
   print('The auto assembler script failed.')
   print(errMsg)
 else
   print('The auto assembler script passed.')
 end


 local scriptStr = [==[
   [Enable]
   alloc(memExample, 0x100)
   label(returnHere)
    
   memExample:
     mov eax,123
     jmp returnHere
    
   00400500:
     jmp memExample
     returnHere:
   [Disable]
     dealloc(memExample)
 ]==]
  
 local checkOk, errMsg = autoAssembleCheck(scriptStr, false, true)
 if not checkOk then
   print('The auto assembler script failed.')
   print(errMsg)
 else
   print('The auto assembler script passed.')
 end


See also[edit]

Related Functions[edit]