Difference between revisions of "Lua:autoAssemble"

From Cheat Engine
Jump to navigation Jump to search
m (Reverted edits by 84.243.24.18 (Talk) to last revision by Dark Byte)
m (Syntax Highlighting.)
 
(20 intermediate revisions by 3 users not shown)
Line 1: Line 1:
'''function''' autoAssemble(''AutoAssemblerScript'', ''TargetSelf'' OPTIONAL)
+
[[Category:Lua]]
 +
{{CodeBox|'''function''' autoAssemble(''text'', [''targetself'', ''disableInfo'']) ''':''' Boolean, Table}}
  
Executes the given string by ce's auto assembler.
+
Runs the Auto Assembler with the given text.
  
tip: Use [[  ]] quotes for multiline script.
+
* If ''targetself'' is set, it will assemble into Cheat Engine itself.
 
+
* Returns ''true'' on success.
Example:
+
* As a secondary return, it provides a table you can use for disabling.
  autoAssemble([[
+
* If ''disableInfo'' is provided, the ''[Disable]'' section will be handled automatically.
    alloc(myscript)
 
    label(returnhere)
 
   
 
    myscript:
 
    mov eax,123
 
    jmp returnhere
 
   
 
    00400500:
 
    jmp myscript
 
    returnhere:   
 
  ]])
 
  
  
 
===Function Parameters===
 
===Function Parameters===
{|width="85%" cellpadding="10%" cellpadding="5%" cellspacing="0" border="0"
+
{|width="85%" cellpadding="5%" cellspacing="0" border="0"
 
!align="left"|Parameter
 
!align="left"|Parameter
 
!align="left"|Type
 
!align="left"|Type
!style="width: 80%;background-color:white;" align="left"|Description
+
!style="width: 60%;background-color:white;" align="left"|Description
 
|-
 
|-
|AutoAssemblerScript
+
|text
 
|String
 
|String
|The script to execute by the auto assembler
+
|The Auto Assembler script text to run.
 
|-
 
|-
|TargetSelf
+
|targetself
|Boolean
+
|Boolean (optional)
|When set to true the autoassembler will assemble the given script in Cheat Engine's address space instead of the target process.  
+
|If true, assembles into Cheat Engine itself. Default is false.
 +
|-
 +
|disableInfo
 +
|Table (optional)
 +
|If provided, will handle the ''[Disable]'' section.
 
|}
 
|}
  
 +
===Returns===
 +
Boolean — ''true'' if the assembly succeeded.<br>
 +
Table — Optional secondary table for handling disable info.
 +
 +
===Example===
 +
<syntaxhighlight lang="lua" line>
 +
-- Simple AutoAssembler script
 +
local disableTable
 +
local success, disableTable = autoAssemble([[
 +
  alloc(newmem,1024)
 +
  // ...
 +
]], true)
 +
 +
if success then
 +
  print("Script assembled successfully")
 +
end
 +
</syntaxhighlight>
 +
 +
{{LuaSeeAlso}}
  
== See also ==
+
{{Assembly}}
* [[Lua]]
 

Latest revision as of 19:26, 25 June 2026

<> Lua API Reference

function autoAssemble(text, [targetself, disableInfo]) : Boolean, Table

Runs the Auto Assembler with the given text.

  • If targetself is set, it will assemble into Cheat Engine itself.
  • Returns true on success.
  • As a secondary return, it provides a table you can use for disabling.
  • If disableInfo is provided, the [Disable] section will be handled automatically.


Function Parameters[edit]

Parameter Type Description
text String The Auto Assembler script text to run.
targetself Boolean (optional) If true, assembles into Cheat Engine itself. Default is false.
disableInfo Table (optional) If provided, will handle the [Disable] section.

Returns[edit]

Boolean — true if the assembly succeeded.
Table — Optional secondary table for handling disable info.

Example[edit]

 1 -- Simple AutoAssembler script
 2 local disableTable
 3 local success, disableTable = autoAssemble([[
 4   alloc(newmem,1024)
 5   // ...
 6 ]], true)
 7 
 8 if success then
 9   print("Script assembled successfully")
10 end

Main Pages

Core Lua documentation entry points

Lua
Script Engine

Assembler and Disassembler Related Lua Functions

Auto assembler, disassembly helpers, instruction size lookup, and assembler callbacks