Lua:autoAssembleCheck

From Cheat Engine
Revision as of 00:30, 5 December 2025 by Leunsel (talk | contribs) (Updated example.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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

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

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

Lua
Script Engine

Related Functions

autoAssemble
autoAssembleCheck
disassemble
splitDisassembledString
getInstructionSize
getPreviousOpcode
registerAssembler
unregisterAssembler