Difference between revisions of "Lua:autoAssembleCheck"
Jump to navigation
Jump to search
(→Related Functions) |
m (Updated example.) |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
[[Category:Lua]] | [[Category:Lua]] | ||
| − | + | {{CodeBox|'''function''' autoAssembleCheck(''text'', ''enable'', ''targetself'')}} | |
| − | '''function''' autoAssembleCheck('' | ||
| − | Checks the script for syntax errors. Returns true on | + | Checks the given Auto Assembler script for syntax errors. |
| − | + | Returns '''true''' on success, or '''false''' with an error message on failure. | |
| − | |||
=== Function Parameters === | === Function Parameters === | ||
| − | + | {|width="85%" cellpadding="5%" cellspacing="0" border="0" | |
| − | {|width="85 | ||
!align="left"|Parameter | !align="left"|Parameter | ||
!align="left"|Type | !align="left"|Type | ||
| − | ! | + | !align="left"|Description |
|- | |- | ||
| − | | | + | | text |
| − | | | + | | String |
| − | |The script to | + | | The Auto Assembler script to validate. |
|- | |- | ||
| − | | | + | | enable |
| − | | | + | | Boolean |
| − | |If | + | | If set, checks the [ENABLE] part of the script. |
|- | |- | ||
| − | | | + | | targetself |
| − | | | + | | Boolean |
| − | |If | + | | If true, checks the script as if assembling into Cheat Engine itself. |
|} | |} | ||
| + | === Example === | ||
| + | <pre> | ||
| + | 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 | ||
| + | </pre> | ||
{{LuaSeeAlso}} | {{LuaSeeAlso}} | ||
| − | + | {{Assembly}} | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
Latest revision as of 00:30, 5 December 2025
| <> 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 |