Difference between revisions of "Lua:autoAssembleCheck"

From Cheat Engine
Jump to navigation Jump to search
(Created page with 'Category:Lua Category:Assembler '''function''' autoAssembleCheck(''AutoAssemblerScript'', ''Enable'' OPTIONAL, ''TargetSelf'' OPTIONAL) ''':''' nil '''-''' boolean Check…')
 
(Related Functions)
 
(One intermediate revision by the same user not shown)
Line 109: Line 109:
  
 
=== Related Functions ===
 
=== Related Functions ===
* [[autoAssemble]]
+
* [[Lua:autoAssemble|autoAssemble]]
* [[AOBScan]]
+
* [[Lua:AOBScan|AOBScan]]
* [[disassemble]]
+
* [[Lua:disassemble|disassemble]]
* [[getInstructionSize]]
+
* [[Lua:getInstructionSize|getInstructionSize]]
* [[getPreviousOpcode]]
+
* [[Lua:getPreviousOpcode|getPreviousOpcode]]
* [[allocateSharedMemory]]
+
* [[Lua:allocateSharedMemory|allocateSharedMemory]]
* [[mapMemory]]
+
* [[Lua:mapMemory|mapMemory]]
* [[unmapMemory]]
+
* [[Lua:unmapMemory|unmapMemory]]
* [[readBytes]]
+
* [[Lua:readBytes|readBytes]]
* [[readPointer]]
+
* [[Lua:readPointer|readPointer]]
* [[writeBytes]]
+
* [[Lua:writeBytes|writeBytes]]
* [[readBytesLocal]]
+
* [[Lua:readBytesLocal|readBytesLocal]]
* [[readPointerLocal]]
+
* [[Lua:readPointerLocal|readPointerLocal]]
* [[writeBytesLocal]]
+
* [[Lua:writeBytesLocal|writeBytesLocal]]
* [[wordToByteTable]]
+
* [[Lua:wordToByteTable|wordToByteTable]]
* [[dwordToByteTable]]
+
* [[Lua:dwordToByteTable|dwordToByteTable]]
* [[qwordToByteTable]]
+
* [[Lua:qwordToByteTable|qwordToByteTable]]
* [[floatToByteTable]]
+
* [[Lua:floatToByteTable|floatToByteTable]]
* [[doubleToByteTable]]
+
* [[Lua:doubleToByteTable|doubleToByteTable]]
* [[stringToByteTable]]
+
* [[Lua:stringToByteTable|stringToByteTable]]
* [[wideStringToByteTable]]
+
* [[Lua:wideStringToByteTable|wideStringToByteTable]]
* [[byteTableToWord]]
+
* [[Lua:byteTableToWord|byteTableToWord]]
* [[byteTableToDword]]
+
* [[Lua:byteTableToDword|byteTableToDword]]
* [[byteTableToQword]]
+
* [[Lua:byteTableToQword|byteTableToQword]]
* [[byteTableToFloat]]
+
* [[Lua:byteTableToFloat|byteTableToFloat]]
* [[byteTableToDouble]]
+
* [[Lua:byteTableToDouble|byteTableToDouble]]
* [[byteTableToString]]
+
* [[Lua:byteTableToString|byteTableToString]]
* [[byteTableToWideString]]
+
* [[Lua:byteTableToWideString|byteTableToWideString]]

Latest revision as of 01:17, 25 January 2018

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]