Lua:autoAssembleCheck

From Cheat Engine
Jump to navigation Jump to search
<> Function

function autoAssembleCheck(text, enable, targetself)

Checks the given Auto Assembler script for syntax errors. Returns true on success, or false with an error message on failure.

Function Parameters[edit]

Parameter Type Description
text String The Auto Assembler script to validate.
enable Boolean If set, checks the [ENABLE] part of the script.
targetself Boolean If true, checks the script as if assembling into Cheat Engine itself.

Example[edit]

local script = [[
alloc(newmem,2048,"cheatengine-x86_64-SSE4-AVX2.exe"+3E18)
label(returnhere)
label(originalcode)
label(exit)

newmem: //this is allocated memory, you have read,write,execute access
//place your code here

originalcode:
lea rsp,[rsp+28]

exit:
jmp returnhere

"cheatengine-x86_64-SSE4-AVX2.exe"+3E18:
jmp newmem
returnhere:
]]

local ok, err = autoAssembleCheck(script, true, false)
if ok then
  print("Script is valid")
else
  print("Syntax error:", err)
end

See also[edit]

Lua
Script Engine

Related Functions[edit]

autoAssemble
autoAssembleCheck
disassemble
splitDisassembledString
getInstructionSize
getPreviousOpcode
registerAssembler
unregisterAssembler