Difference between revisions of "Lua"

From Cheat Engine
Jump to navigation Jump to search
(Initial draft)
 
m (Fixed a typo.)
 
(57 intermediate revisions by 18 users not shown)
Line 1: Line 1:
Cheat Engine comes with an extensive set of Lua functions you can use inside cheattables, trainers and standalone scripts.
+
<!-- Updated to 6.7 celua.text TheyCallMeTim13 -->
 +
<!-- Updated to 7.5 celua.text Leunsel -->
 +
<!-- This page uses Template:LuaIndexBox and Template:LuaIndexItem for repeated reference lists now. -->
 +
[[Category:Lua]]
 +
{{NeedWork}}
  
* [[readBytes]]: Returns the bytes at the given address. If ReturnAsTable is true it will return a table instead of multiple bytes
+
<div style="background:#F7FBFF; width: fit-content; border:1px solid #4A90E2; border-left:6px solid #4A90E2; padding:0.8em 0.95em; margin:0.8em 0;">
* [[writeBytes]]: Write the given bytes to the given address from a table
+
<span style="font-size:1.35em; font-weight:bold; color:#1F4E79;">Cheat Engine Lua API Index</span><br>
* [[readBytesLocal]]: See readBytes but then it's for Cheat engine's memory
+
A task-oriented reference index for Cheat Engine's Lua functions, classes, globals, and scripting helpers.
* [[writeBytesLocal]]: See writeBytes but then it's for Cheat Engine's memory
+
</div>
* [[readInteger]]: Reads a integer from the specified address
 
* [[readFloat]]: Reads a single precision floating point value from the specified address
 
* [[readDouble]]: Reads a double precision floating point value from the specified address
 
* [[readString]]: Reads a string from memory untill it ghits a 0-terminator. maxlength is just so you won't freeze for too long
 
* [[writeInteger]]: Writes an integer to the specified address. Returns true on success
 
* [[writeFloat]]: Writes a single precision floating point to the specified address. Returns true on success
 
* [[writeDouble]]: Writes a double precision floating point to the specified address. Returns true on success
 
* [[writeString]]: Write a string to the specified address. Returns true on success
 
* [[getAddress]]: Returns the address of a symbol. Can be a modulename or an export
 
* [[reinitializeSymbolhandler]]: Reinitializes the symbolhandler. E.g when new modules have been loaded
 
* [[generateAPIHookScript]]: Generates an auto assembler script which will hook the given address when executed
 
* [[autoAssemble]]: Runs the auto assembler with the given text
 
* [[showMessage]]: Shows a messagebox with the given text
 
* [[messageDialog]]: Pops up a messagebox
 
* [[sleep]]: Pauses for the number of specified milliseconds
 
* [[getOpenedProcessID]]: Returns the currently opened process
 
* [[getProcessIDFromProcessName]]: Returns a processid
 
* [[openProcess]]: Causes cheat engine to open the given processname or id
 
* [[getForegroundProcess]]: Returns the processid of the current foreground window
 
* [[pause]]: Pauses the current opened process
 
* [[unpause]]: Resumes the current opened process
 
* [[getPixel]]: Returns the rgb value of the pixel at the specific screen coordinate
 
* [[getMousePos]]: Returns the x,y coordinates of the mouse
 
* [[setMousePos]]: Sets the mouse position
 
* [[isKeyPressed]]: Returns true if the specified key is currently pressed
 
* [[keyDown]]: Causes the key to go into down state
 
  
 +
Cheat Engine exposes an extensive Lua API for cheat tables, trainers, and standalone scripts. This page is a task-oriented index: choose the area you are working in, then follow a function link for its detailed reference.
  
keyUp(key)
+
__TOC__
Causes the key to go up
 
  
 +
== Variables ==
  
doKeyPress(key)
+
=== Globals ===
simulates a key press
+
<div style="border:1px solid #4A90E2; background:#F7FBFF; margin:0.8em 0; font-family:monospace; max-width:1100px;">
 +
<div style="background:#E8F2FF; color:#1F4E79; font-weight:bold; padding:0.5em 0.75em; border-bottom:1px solid #4A90E2;">
 +
Global Variables
 +
</div>
 +
<div style="display:flex; background:#F0F6FF; color:#1F4E79; font-weight:bold; border-bottom:1px solid #C7DDF7;">
 +
<div style="flex:0 0 26%; min-width:190px; padding:0.35em 0.65em;">Name</div>
 +
<div style="flex:0 0 18%; min-width:120px; padding:0.35em 0.65em; border-left:1px solid #DCEBFF;">Type</div>
 +
<div style="flex:1; padding:0.35em 0.65em; border-left:1px solid #DCEBFF;">Description</div>
 +
</div>
 +
<div style="display:flex; border-bottom:1px solid #E2EEF9;">
 +
<div style="flex:0 0 26%; min-width:190px; padding:0.35em 0.65em; font-weight:bold; overflow-wrap:anywhere;">[[Lua:TrainerOrigin|TrainerOrigin]]</div>
 +
<div style="flex:0 0 18%; min-width:120px; padding:0.35em 0.65em; border-left:1px solid #E2EEF9;">string</div>
 +
<div style="flex:1; padding:0.35em 0.65em; border-left:1px solid #E2EEF9; line-height:1.55;">Path of the trainer that launched Cheat Engine. Only set when Cheat Engine was launched as a trainer.</div>
 +
</div>
 +
<div style="display:flex; border-bottom:1px solid #E2EEF9;">
 +
<div style="flex:0 0 26%; min-width:190px; padding:0.35em 0.65em; font-weight:bold; overflow-wrap:anywhere;">[[Lua:process|process]]</div>
 +
<div style="flex:0 0 18%; min-width:120px; padding:0.35em 0.65em; border-left:1px solid #E2EEF9;">string</div>
 +
<div style="flex:1; padding:0.35em 0.65em; border-left:1px solid #E2EEF9; line-height:1.55;">Main module name of the currently opened process (e.g. <code>mygame.exe</code> or module name).</div>
 +
</div>
 +
<div style="display:flex; border-bottom:1px solid #E2EEF9;">
 +
<div style="flex:0 0 26%; min-width:190px; padding:0.35em 0.65em; font-weight:bold; overflow-wrap:anywhere;">[[Lua:MainForm|MainForm]]</div>
 +
<div style="flex:0 0 18%; min-width:120px; padding:0.35em 0.65em; border-left:1px solid #E2EEF9;">object</div>
 +
<div style="flex:1; padding:0.35em 0.65em; border-left:1px solid #E2EEF9; line-height:1.55;">The main Cheat Engine GUI form object.</div>
 +
</div>
 +
<div style="display:flex; border-bottom:1px solid #E2EEF9;">
 +
<div style="flex:0 0 26%; min-width:190px; padding:0.35em 0.65em; font-weight:bold; overflow-wrap:anywhere;">[[Lua:AddressList|AddressList]]</div>
 +
<div style="flex:0 0 18%; min-width:120px; padding:0.35em 0.65em; border-left:1px solid #E2EEF9;">object</div>
 +
<div style="flex:1; padding:0.35em 0.65em; border-left:1px solid #E2EEF9; line-height:1.55;">The address list object of the main Cheat Engine GUI (cheat table address list).</div>
 +
</div>
 +
</div>
  
 +
=== CPU / Debug Variables (Registers) ===
 +
<div style="border:1px solid #4A90E2; background:#F7FBFF; margin:0.8em 0; font-family:monospace; max-width:1100px;">
 +
<div style="background:#E8F2FF; color:#1F4E79; font-weight:bold; padding:0.5em 0.75em; border-bottom:1px solid #4A90E2;">
 +
CPU / Debug Variables
 +
</div>
 +
<div style="display:flex; background:#F0F6FF; color:#1F4E79; font-weight:bold; border-bottom:1px solid #C7DDF7;">
 +
<div style="flex:0 0 26%; min-width:190px; padding:0.35em 0.65em;">Register / Variable</div>
 +
<div style="flex:0 0 18%; min-width:120px; padding:0.35em 0.65em; border-left:1px solid #DCEBFF;">Architecture</div>
 +
<div style="flex:1; padding:0.35em 0.65em; border-left:1px solid #DCEBFF;">Description</div>
 +
</div>
 +
<div style="display:flex; border-bottom:1px solid #E2EEF9;">
 +
<div style="flex:0 0 26%; min-width:190px; padding:0.35em 0.65em; font-weight:bold; overflow-wrap:anywhere;">EFLAGS</div>
 +
<div style="flex:0 0 18%; min-width:120px; padding:0.35em 0.65em; border-left:1px solid #E2EEF9;">32/64-bit</div>
 +
<div style="flex:1; padding:0.35em 0.65em; border-left:1px solid #E2EEF9; line-height:1.55;">CPU flags register value available in the debug context.</div>
 +
</div>
 +
<div style="display:flex; border-bottom:1px solid #E2EEF9;">
 +
<div style="flex:0 0 26%; min-width:190px; padding:0.35em 0.65em; font-weight:bold; overflow-wrap:anywhere;">EAX, EBX, ECX, EDX, EDI, ESI, EBP, ESP, EIP</div>
 +
<div style="flex:0 0 18%; min-width:120px; padding:0.35em 0.65em; border-left:1px solid #E2EEF9;">32/64-bit</div>
 +
<div style="flex:1; padding:0.35em 0.65em; border-left:1px solid #E2EEF9; line-height:1.55;">Standard 32-bit register values (present when debugging 32-bit contexts or in compatible views).</div>
 +
</div>
 +
<div style="display:flex; border-bottom:1px solid #E2EEF9;">
 +
<div style="flex:0 0 26%; min-width:190px; padding:0.35em 0.65em; font-weight:bold; overflow-wrap:anywhere;">RAX, RBX, RCX, RDX, RDI, RSI, RBP, RSP, RIP, R8, R9, R10, R11, R12, R13, R14, R15</div>
 +
<div style="flex:0 0 18%; min-width:120px; padding:0.35em 0.65em; border-left:1px solid #E2EEF9;">64-bit only</div>
 +
<div style="flex:1; padding:0.35em 0.65em; border-left:1px solid #E2EEF9; line-height:1.55;">64-bit register values available in 64-bit debug contexts.</div>
 +
</div>
 +
</div>
  
shellExecute(command, parameters OPTIONAL, folder OPTIONAL, showcommand OPTIONAL)
+
== Functions ==
Executes a given command
 
  
 +
Function names follow consistent patterns: <code>create...</code> creates an object or window, <code>get...</code> retrieves data, <code>set...</code> changes a setting, <code>read...</code>/<code>write...</code> transfer data, and <code>register...</code>/<code>unregister...</code> manage callbacks. Related functions are kept together where possible.
  
 +
=== Quick navigation ===
 +
<div style="border:1px solid #4A90E2; background:#F7FBFF; margin:0.8em 0; font-family:monospace; max-width:1100px;">
 +
<div style="background:#E8F2FF; color:#1F4E79; font-weight:bold; padding:0.5em 0.75em; border-bottom:1px solid #4A90E2;">
 +
Quick Navigation
 +
</div>
 +
<div style="display:flex; background:#F0F6FF; color:#1F4E79; font-weight:bold; border-bottom:1px solid #C7DDF7;">
 +
<div style="flex:0 0 32%; min-width:220px; padding:0.35em 0.65em;">What do you want to do?</div>
 +
<div style="flex:1; padding:0.35em 0.65em;">Recommended sections</div>
 +
</div>
 +
<div style="display:flex; border-bottom:1px solid #E2EEF9;">
 +
<div style="flex:0 0 32%; min-width:220px; padding:0.35em 0.65em; font-weight:bold; overflow-wrap:anywhere;">Manage a table or build a trainer</div>
 +
<div style="flex:1; padding:0.35em 0.65em; border-left:1px solid #E2EEF9; line-height:1.55;">[[#Cheat Table|Cheat Table]], [[#Trainers|Trainers]], [[#Protection|Protection]]</div>
 +
</div>
 +
<div style="display:flex; border-bottom:1px solid #E2EEF9;">
 +
<div style="flex:0 0 32%; min-width:220px; padding:0.35em 0.65em; font-weight:bold; overflow-wrap:anywhere;">Find, read, write, or convert memory</div>
 +
<div style="flex:1; padding:0.35em 0.65em; border-left:1px solid #E2EEF9; line-height:1.55;">[[#Scanning|Scanning]], [[#Memory|Memory]], [[#Conversions|Conversions]], [[#Addresses|Addresses]]</div>
 +
</div>
 +
<div style="display:flex; border-bottom:1px solid #E2EEF9;">
 +
<div style="flex:0 0 32%; min-width:220px; padding:0.35em 0.65em; font-weight:bold; overflow-wrap:anywhere;">Work with a process, threads, windows, or handles</div>
 +
<div style="flex:1; padding:0.35em 0.65em; border-left:1px solid #E2EEF9; line-height:1.55;">[[#Process|Process]], [[#Threads|Threads]], [[#Handles|Handles]], [[#Input Devices|Input Devices]]</div>
 +
</div>
 +
<div style="display:flex; border-bottom:1px solid #E2EEF9;">
 +
<div style="flex:0 0 32%; min-width:220px; padding:0.35em 0.65em; font-weight:bold; overflow-wrap:anywhere;">Automate Cheat Engine or generate code</div>
 +
<div style="flex:1; padding:0.35em 0.65em; border-left:1px solid #E2EEF9; line-height:1.55;">[[#Lua|Lua]], [[#Assembly|Assembly]], [[#Auto Assembler|Auto Assembler]], [[#Cheat Engine|Cheat Engine]]</div>
 +
</div>
 +
<div style="display:flex; border-bottom:1px solid #E2EEF9;">
 +
<div style="flex:0 0 32%; min-width:220px; padding:0.35em 0.65em; font-weight:bold; overflow-wrap:anywhere;">Build forms, controls, or visual tools</div>
 +
<div style="flex:1; padding:0.35em 0.65em; border-left:1px solid #E2EEF9; line-height:1.55;">[[#Forms and Windows|Forms and Windows]], [[#Screen|Screen]], [[#Sounds|Sounds]], [[#Classes|Classes]]</div>
 +
</div>
 +
<div style="display:flex; border-bottom:1px solid #E2EEF9;">
 +
<div style="flex:0 0 32%; min-width:220px; padding:0.35em 0.65em; font-weight:bold; overflow-wrap:anywhere;">Debug, use the driver, or access DBVM</div>
 +
<div style="flex:1; padding:0.35em 0.65em; border-left:1px solid #E2EEF9; line-height:1.55;">[[#Debugger|Debugger]], [[#DBK (Driver-Based Kernel)|DBK]], [[#DBVM|DBVM]]</div>
 +
</div>
 +
<div style="display:flex; border-bottom:1px solid #E2EEF9;">
 +
<div style="flex:0 0 32%; min-width:220px; padding:0.35em 0.65em; font-weight:bold; overflow-wrap:anywhere;">Find less common CE 7.5 APIs</div>
 +
<div style="flex:1; padding:0.35em 0.65em; border-left:1px solid #E2EEF9; line-height:1.55;">[[#Extended API reference (CE 7.5)|Extended API reference]] — pipes, SQL, .NET, XML, CEServer, and additional factories</div>
 +
</div>
 +
</div>
  
 +
=== Function naming guide ===
 +
<div style="border:1px solid #4A90E2; background:#F7FBFF; margin:0.8em 0; font-family:monospace; max-width:1100px;">
 +
<div style="background:#E8F2FF; color:#1F4E79; font-weight:bold; padding:0.5em 0.75em; border-bottom:1px solid #4A90E2;">
 +
Function Naming Guide
 +
</div>
 +
<div style="display:flex; background:#F0F6FF; color:#1F4E79; font-weight:bold; border-bottom:1px solid #C7DDF7;">
 +
<div style="flex:0 0 32%; min-width:220px; padding:0.35em 0.65em;">Prefix / pattern</div>
 +
<div style="flex:1; padding:0.35em 0.65em;">Meaning</div>
 +
</div>
 +
<div style="display:flex; border-bottom:1px solid #E2EEF9;">
 +
<div style="flex:0 0 32%; min-width:220px; padding:0.35em 0.65em; font-weight:bold; overflow-wrap:anywhere;"><code>create...</code></div>
 +
<div style="flex:1; padding:0.35em 0.65em; border-left:1px solid #E2EEF9; line-height:1.55;">Creates an object, control, stream, worker, or other resource. Check the returned class before using it.</div>
 +
</div>
 +
<div style="display:flex; border-bottom:1px solid #E2EEF9;">
 +
<div style="flex:0 0 32%; min-width:220px; padding:0.35em 0.65em; font-weight:bold; overflow-wrap:anywhere;"><code>get...</code>, <code>enum...</code></div>
 +
<div style="flex:1; padding:0.35em 0.65em; border-left:1px solid #E2EEF9; line-height:1.55;">Retrieves one value/object or enumerates a collection, usually without changing state.</div>
 +
</div>
 +
<div style="display:flex; border-bottom:1px solid #E2EEF9;">
 +
<div style="flex:0 0 32%; min-width:220px; padding:0.35em 0.65em; font-weight:bold; overflow-wrap:anywhere;"><code>set...</code>, <code>enable...</code></div>
 +
<div style="flex:1; padding:0.35em 0.65em; border-left:1px solid #E2EEF9; line-height:1.55;">Changes a setting, protection, or runtime state.</div>
 +
</div>
 +
<div style="display:flex; border-bottom:1px solid #E2EEF9;">
 +
<div style="flex:0 0 32%; min-width:220px; padding:0.35em 0.65em; font-weight:bold; overflow-wrap:anywhere;"><code>read...</code>, <code>write...</code></div>
 +
<div style="flex:1; padding:0.35em 0.65em; border-left:1px solid #E2EEF9; line-height:1.55;">Transfers data. Unless the name ends in <code>Local</code>, memory functions normally operate on the opened target process.</div>
 +
</div>
 +
<div style="display:flex; border-bottom:1px solid #E2EEF9;">
 +
<div style="flex:0 0 32%; min-width:220px; padding:0.35em 0.65em; font-weight:bold; overflow-wrap:anywhere;"><code>register...</code>, <code>unregister...</code></div>
 +
<div style="flex:1; padding:0.35em 0.65em; border-left:1px solid #E2EEF9; line-height:1.55;">Adds or removes a callback, handler, hook, or extension. Keep the returned ID when an unregister function requires it.</div>
 +
</div>
 +
</div>
  
speedhack_setSpeed(speed)
+
=== Cheat Table ===
Enabled the speedhack if it was not active yet and sets the given speed
+
These functions help manage the cheat table and its files.
 +
{{LuaIndexBox
 +
|title=Cheat Table
 +
|content=
 +
{{LuaIndexItem
 +
|page=getAddressList
 +
|label=getAddressList
 +
|description=Returns the cheat table [[Lua:Class:Addresslist|Addresslist]] object.
 +
}}
 +
{{LuaIndexItem
 +
|page=findTableFile
 +
|label=findTableFile
 +
|description=Returns a [[Lua:Class:TableFile|TableFile]] stored in the cheat table (search by filename or identifier).
 +
}}
 +
{{LuaIndexItem
 +
|page=createTableFile
 +
|label=createTableFile
 +
|description=Adds a new file entry to the cheat table.
 +
}}
 +
{{LuaIndexItem
 +
|page=loadTable
 +
|label=loadTable
 +
|description=Loads a ".ct" or ".cetrainer" file or stream into the cheat table.
 +
}}
 +
{{LuaIndexItem
 +
|page=saveTable
 +
|label=saveTable
 +
|description=Saves the current cheat table to disk.
 +
}}
 +
}}
  
 +
=== Trainers ===
 +
Functions related to the trainer (.exe) generator.
 +
{{LuaIndexBox
 +
|title=Trainers
 +
|content=
 +
{{LuaIndexItem
 +
|page=registerEXETrainerFeature
 +
|label=registerEXETrainerFeature
 +
|description=Adds a new feature to the EXE trainer generator window and calls your callback when a user builds a .exe trainer.
 +
}}
 +
{{LuaIndexItem
 +
|page=unregisterEXETrainerFeature
 +
|label=unregisterEXETrainerFeature
 +
|description=Unregisters a previously registered trainer feature.
 +
}}
 +
}}
  
injectDll(filename)
+
=== Protection ===
Injects a dll, and returns true on success
+
Functions for protecting Cheat Engine or encoding code.
 +
{{LuaIndexBox
 +
|title=Protection
 +
|content=
 +
{{LuaIndexItem
 +
|page=activateProtection
 +
|label=activateProtection
 +
|description=Prevents basic memory scanners from opening or inspecting the Cheat Engine process.
 +
}}
 +
{{LuaIndexItem
 +
|page=enableDRM
 +
|label=enableDRM
 +
|description=Enables kernel-mode protections or DRM measures to prevent normal memory scanners from reading the Cheat Engine process.
 +
}}
 +
{{LuaIndexItem
 +
|page=encodeFunction
 +
|label=encodeFunction
 +
|description=Encodes a given Lua function to a string that can be stored/transferred; can be decoded later with [[Lua:decodeFunction|decodeFunction]].
 +
}}
 +
{{LuaIndexItem
 +
|page=decodeFunction
 +
|label=decodeFunction
 +
|description=Decodes an encoded function string back into a callable Lua function.
 +
}}
 +
}}
  
 +
=== Scanning ===
 +
Functions that control and query memory scans.
 +
{{LuaIndexBox
 +
|title=Scanning
 +
|content=
 +
{{LuaIndexItem
 +
|page=AOBScan
 +
|label=AOBScan
 +
|description=Scans the currently opened process for an array-of-bytes (AOB) pattern and returns a [[Lua:Class:StringList|StringList]] of all matches.
 +
}}
 +
{{LuaIndexItem
 +
|page=AOBScanModuleUnique
 +
|label=AOBScanModuleUnique
 +
|description=Scans the process memory for a byte pattern and returns the address if exactly one unique match is found; returns <code>nil</code> otherwise.
 +
}}
 +
{{LuaIndexItem
 +
|page=AOBScanUnique
 +
|label=AOBScanUnique
 +
|description=Scans the entire process for a pattern and returns the address if exactly one unique match exists; returns <code>nil</code> otherwise.
 +
}}
 +
{{LuaIndexItem
 +
|page=getCurrentMemscan
 +
|label=getCurrentMemscan
 +
|description=Returns the currently active scan session as a [[Lua:Class:MemScan|MemScan]] object.
 +
}}
 +
}}
  
getCheatEngineDir()  
+
=== Process ===
Returns the folder Cheat Engine is located at
+
Functions for creating/opening processes and querying system/process state.
 +
{{LuaIndexBox
 +
|title=Process
 +
|content=
 +
{{LuaIndexItem
 +
|page=createProcess
 +
|label=createProcess
 +
|description=Creates (and optionally debugs) a new process.
 +
}}
 +
{{LuaIndexItem
 +
|page=openProcess
 +
|label=openProcess
 +
|description=Opens a process given a process name or PID; attaches Cheat Engine to it for memory access.
 +
}}
 +
{{LuaIndexItem
 +
|page=onOpenProcess
 +
|label=onOpenProcess
 +
|description=Callback invoked by Cheat Engine when it opens a process (user-defined handler).
 +
}}
 +
{{LuaIndexItem
 +
|page=getForegroundProcess
 +
|label=getForegroundProcess
 +
|description=Returns the process ID (PID) of the currently foreground (top) window process.
 +
}}
 +
{{LuaIndexItem
 +
|page=getOpenedProcessID
 +
|label=getOpenedProcessID
 +
|description=Returns the PID of the currently opened/attached process.
 +
}}
 +
{{LuaIndexItem
 +
|page=getProcessIDFromProcessName
 +
|label=getProcessIDFromProcessName
 +
|description=Returns the PID for a given process name (if running).
 +
}}
 +
{{LuaIndexItem
 +
|page=openFileAsProcess
 +
|label=openFileAsProcess
 +
|description=Opens a file and treats it like a process (gives memory access similar to opening a process).
 +
}}
 +
{{LuaIndexItem
 +
|page=saveOpenedFile
 +
|label=saveOpenedFile
 +
|description=Saves changes made to the opened file.
 +
}}
 +
{{LuaIndexItem
 +
|page=setPointerSize
 +
|label=setPointerSize
 +
|description=Sets the pointer size (in bytes) Cheat Engine will use (e.g. 4 or 8); useful if a 64-bit process requires 32-bit pointer handling.
 +
}}
 +
{{LuaIndexItem
 +
|page=setAssemblerMode
 +
|label=setAssemblerMode
 +
|description=Sets assembler bit mode: <code>0</code> = 32-bit, <code>1</code> = 64-bit.
 +
}}
 +
{{LuaIndexItem
 +
|page=getProcesslist
 +
|label=getProcesslist
 +
|description=Returns a system process list object.
 +
}}
 +
{{LuaIndexItem
 +
|page=getWindowlist
 +
|label=getWindowlist
 +
|description=Returns a list of top-level windows.
 +
}}
 +
{{LuaIndexItem
 +
|page=pause
 +
|label=pause
 +
|description=Pauses the currently opened process.
 +
}}
 +
{{LuaIndexItem
 +
|page=unpause
 +
|label=unpause
 +
|description=Resumes the currently opened process.
 +
}}
 +
{{LuaIndexItem
 +
|page=targetIs64Bit
 +
|label=targetIs64Bit
 +
|description=Returns <code>true</code> if the target process is 64-bit, otherwise <code>false</code>.
 +
}}
 +
{{LuaIndexItem
 +
|page=enumModules
 +
|label=enumModules
 +
|description=Returns a table with information about each module in the current process (or a specified PID).
 +
}}
 +
{{LuaIndexItem
 +
|page=enumMemoryRegions
 +
|label=enumMemoryRegions
 +
|description=Returns a table containing the memory layout with information about each memory region.
 +
}}
 +
{{LuaIndexItem
 +
|page=closeRemoteHandle
 +
|label=closeRemoteHandle
 +
|description=Closes a remote handle to a process.
 +
}}
 +
}}
  
 +
=== Threads ===
 +
{{LuaIndexBox
 +
|title=Threads
 +
|content=
 +
{{LuaIndexItem
 +
|page=getCPUCount
 +
|label=getCPUCount
 +
|description=Returns the number of CPU cores available on the system.
 +
}}
 +
{{LuaIndexItem
 +
|page=getThreadlist
 +
|label=getThreadlist
 +
|description=Fills a List object with the thread list of the currently opened process (returns thread IDs and basic info).
 +
}}
 +
{{LuaIndexItem
 +
|page=inMainThread
 +
|label=inMainThread
 +
|description=Returns <code>true</code> if the current Lua code is running in the main thread (available in CE 6.4+); otherwise <code>false</code>.
 +
}}
 +
{{LuaIndexItem
 +
|page=synchronize
 +
|label=synchronize
 +
|description=Executes the provided function in the main thread and returns that function's return value. Useful for GUI updates or operations that must run on the main thread.
 +
}}
 +
{{LuaIndexItem
 +
|page=queue
 +
|label=queue
 +
|description=Schedules the provided function to run in the main thread but does not wait for the result (fire-and-forget).
 +
}}
 +
{{LuaIndexItem
 +
|page=checkSynchronize
 +
|label=checkSynchronize
 +
|description=Intended to be called from the main thread's loop to process pending synchronized calls when using threads and <code>synchronize</code>/<code>queue</code>.
 +
}}
 +
}}
  
allocateSharedMemory(name, size)
+
=== Handles ===
Creates a shared memory object of the given size if it doesn't exist yet. If size is not given and there is no shared region with this name then the default size of 4096 is used
+
{{LuaIndexBox
It then maps this shared memory block into the currently targeted process. It returns the address of mapped region in the target process
+
|title=Handles
 
+
|content=
beep() 
+
{{LuaIndexItem
Plays the fabulous beep/ping sound!
+
|page=getHandleList
 +
|label=getHandleList
 +
|description=Returns a table (or list object) containing system handles (open handles) for the system or the current process, depending on context.
 +
}}
 +
}}
  
 +
=== Addresses ===
 +
These functions help convert between memory addresses and symbol/CE address string representations.
 +
{{LuaIndexBox
 +
|title=Addresses
 +
|content=
 +
{{LuaIndexItem
 +
|page=getAddress
 +
|label=getAddress
 +
|description=Returns the numeric address of a symbol (module+export, label, or CE symbol). Raises an error if the symbol cannot be resolved.
 +
}}
 +
{{LuaIndexItem
 +
|page=getAddressSafe
 +
|label=getAddressSafe
 +
|description=Same as <code>getAddress</code> but returns <code>nil</code> if the symbol cannot be found (does not throw).
 +
}}
 +
{{LuaIndexItem
 +
|page=getNameFromAddress
 +
|label=getNameFromAddress
 +
|description=Returns the address formatted as a string, preferring symbol/module+offset notation when available.
 +
}}
 +
{{LuaIndexItem
 +
|page=registerSymbol
 +
|label=registerSymbol
 +
|description=Assigns the specified symbol name to an address (adds a user-defined symbol).
 +
}}
 +
{{LuaIndexItem
 +
|page=unregisterSymbol
 +
|label=unregisterSymbol
 +
|description=Removes a previously registered symbol mapping for an address.
 +
}}
 +
{{LuaIndexItem
 +
|page=getSymbolInfo
 +
|label=getSymbolInfo
 +
|description=Returns a table/object with symbol information (module name, search key, address, size), matching the [[Lua:Class:SymbolList|SymbolList]] structure.
 +
}}
 +
{{LuaIndexItem
 +
|page=reinitializeSymbolhandler
 +
|label=reinitializeSymbolhandler
 +
|description=Reinitializes the symbol handler (useful after loading new modules).
 +
}}
 +
{{LuaIndexItem
 +
|page=inModule
 +
|label=inModule
 +
|description=Returns <code>true</code> if the specified address lies inside a loaded module.
 +
}}
 +
{{LuaIndexItem
 +
|page=inSystemModule
 +
|label=inSystemModule
 +
|description=Returns <code>true</code> if the address is inside a system module (OS module), e.g., kernel or system DLLs.
 +
}}
 +
{{LuaIndexItem
 +
|page=getModuleSize
 +
|label=getModuleSize
 +
|description=Returns the size (in bytes) of the specified module. Use <code>getAddress</code> to retrieve the module base address first if needed.
 +
}}
 +
{{LuaIndexItem
 +
|page=errorOnLookupFailure
 +
|label=errorOnLookupFailure
 +
|description=Sets whether address/symbol lookups will throw errors on failure or return <code>0</code>/<code>nil</code> depending on configuration.
 +
}}
 +
{{LuaIndexItem
 +
|page=registerSymbolLookupCallback
 +
|label=registerSymbolLookupCallback
 +
|description=Registers a callback function invoked when a symbol is parsed/loaded.
 +
}}
 +
{{LuaIndexItem
 +
|page=unregisterSymbolLookupCallback
 +
|label=unregisterSymbolLookupCallback
 +
|description=Unregisters a previously registered symbol lookup callback.
 +
}}
 +
{{LuaIndexItem
 +
|page=registerAddressLookupCallback
 +
|label=registerAddressLookupCallback
 +
|description=Registers a callback called when an address-to-name conversion is requested.
 +
}}
 +
{{LuaIndexItem
 +
|page=unregisterAddressLookupCallback
 +
|label=unregisterAddressLookupCallback
 +
|description=Unregisters the address lookup callback.
 +
}}
 +
{{LuaIndexItem
 +
|page=reinitializeDotNetSymbolhandler
 +
|label=reinitializeDotNetSymbolhandler
 +
|description=Reinitializes only the .NET portion of the symbol handler (useful when .NET modules change).
 +
}}
 +
}}
  
xmplayer_playXM(filename)
+
=== Memory ===
Plays the given filename using the xmplayer
+
{{LuaIndexBox
 +
|title=Memory
 +
|content=
 +
{{LuaIndexItem
 +
|page=allocateMemory
 +
|label=allocateMemory
 +
|description=Allocates executable/non-executable memory in the target process and returns the allocated address.
 +
}}
 +
{{LuaIndexItem
 +
|page=deAlloc
 +
|label=deAlloc
 +
|description=Frees memory previously allocated in the target process.
 +
}}
 +
{{LuaIndexItem
 +
|page=allocateSharedMemory
 +
|label=allocateSharedMemory
 +
|description=Creates or opens a named shared memory object of the given size for interprocess communication.
 +
}}
 +
{{LuaIndexItem
 +
|page=createSection
 +
|label=createSection
 +
|description=Creates a memory section object (OS-specific) for sharing or mapping memory.
 +
}}
 +
{{LuaIndexItem
 +
|page=mapViewOfSection
 +
|label=mapViewOfSection
 +
|description=Maps a created section into the process address space, returning the mapped base address.
 +
}}
 +
{{LuaIndexItem
 +
|page=unMapViewOfSection
 +
|label=unMapViewOfSection
 +
|description=Unmaps a previously mapped section view from the process address space.
 +
}}
 +
{{LuaIndexItem
 +
|page=copyMemory
 +
|label=copyMemory
 +
|description=Copies memory from a source address to a destination address (can be used within target process or between processes depending on API).
 +
}}
 +
{{LuaIndexItem
 +
|page=compareMemory
 +
|label=compareMemory
 +
|description=Compares two memory regions (can be used within target process or between processes depending on API).
 +
}}
 +
{{LuaIndexItem
 +
|page=allocateKernelMemory
 +
|label=allocateKernelMemory
 +
|description=Allocates a block of nonpaged kernel memory (requires driver or appropriate privileges) and returns its address.
 +
}}
 +
{{LuaIndexItem
 +
|page=freeKernelMemory
 +
|label=freeKernelMemory
 +
|description=Frees kernel-mode memory previously allocated.
 +
}}
 +
{{LuaIndexItem
 +
|page=mapMemory
 +
|label=mapMemory
 +
|description=Maps memory from one process context into another usermode context (maps a specified address from PID A into PID B's address space).
 +
}}
 +
{{LuaIndexItem
 +
|page=unmapMemory
 +
|label=unmapMemory
 +
|description=Unmaps memory previously mapped with <code>mapMemory</code>.
 +
}}
 +
{{LuaIndexItem
 +
|page=createMemoryStream
 +
|label=createMemoryStream
 +
|description=Creates a memory stream object that can be used to read/write memory data conveniently from Lua.
 +
}}
 +
}}
  
 +
==== Reading from Target Process ====
 +
{{LuaIndexBox
 +
|title=Reading from Target Process
 +
|content=
 +
{{LuaIndexItem
 +
|page=readBytes
 +
|label=readBytes
 +
|description=Reads raw bytes at the given address. If <code>ReturnAsTable</code> is true, returns a table; otherwise returns multiple byte values.
 +
}}
 +
{{LuaIndexItem
 +
|page=readSmallInteger
 +
|label=readSmallInteger
 +
|description=Reads a 16-bit (word) integer from the specified address. Optional second parameter: if true, reads as signed integer.
 +
}}
 +
{{LuaIndexItem
 +
|page=readInteger
 +
|label=readInteger
 +
|description=Reads a 32-bit (dword) integer from the specified address. Optional second parameter: if true, reads as signed integer.
 +
}}
 +
{{LuaIndexItem
 +
|page=readQword
 +
|label=readQword
 +
|description=Reads a 64-bit (qword) integer from the specified address.
 +
}}
 +
{{LuaIndexItem
 +
|page=readPointer
 +
|label=readPointer
 +
|description=Reads a pointer-sized value: <code>readQword</code> on 64-bit targets, <code>readInteger</code> on 32-bit targets.
 +
}}
 +
{{LuaIndexItem
 +
|page=readFloat
 +
|label=readFloat
 +
|description=Reads a single-precision (32-bit) floating-point value from the specified address.
 +
}}
 +
{{LuaIndexItem
 +
|page=readDouble
 +
|label=readDouble
 +
|description=Reads a double-precision (64-bit) floating-point value from the specified address.
 +
}}
 +
{{LuaIndexItem
 +
|page=readString
 +
|label=readString
 +
|description=Reads a null-terminated string from memory up to <code>maxlength</code> bytes (prevents infinite loops on corrupted memory).
 +
}}
 +
{{LuaIndexItem
 +
|page=readRegionFromFile
 +
|label=readRegionFromFile
 +
|description=Reads a region from a file and writes it to a specific address in the target process.
 +
}}
 +
}}
  
xmplayer_playXM(Stream)
+
==== Reading from Cheat Engine Memory ====
Plays the given memory stream
+
{{LuaIndexBox
 +
|title=Reading from Cheat Engine Memory
 +
|content=
 +
{{LuaIndexItem
 +
|page=readBytesLocal
 +
|label=readBytesLocal
 +
|description=Same as <code>readBytes</code>, but reads from Cheat Engine's own memory.
 +
}}
 +
{{LuaIndexItem
 +
|page=readSmallIntegerLocal
 +
|label=readSmallIntegerLocal
 +
|description=Reads a 16-bit integer from CE's memory. Optional: use signed if second parameter is true.
 +
}}
 +
{{LuaIndexItem
 +
|page=readIntegerLocal
 +
|label=readIntegerLocal
 +
|description=Reads a 32-bit integer from CE's memory. Optional: use signed if second parameter is true.
 +
}}
 +
{{LuaIndexItem
 +
|page=readQwordLocal
 +
|label=readQwordLocal
 +
|description=Reads a 64-bit integer from CE's memory.
 +
}}
 +
{{LuaIndexItem
 +
|page=readPointerLocal
 +
|label=readPointerLocal
 +
|description=Reads a pointer-sized value from CE's memory (64-bit or 32-bit depending on CE build).
 +
}}
 +
{{LuaIndexItem
 +
|page=readFloatLocal
 +
|label=readFloatLocal
 +
|description=Reads a single-precision float from CE's memory.
 +
}}
 +
{{LuaIndexItem
 +
|page=readDoubleLocal
 +
|label=readDoubleLocal
 +
|description=Reads a double-precision float from CE's memory.
 +
}}
 +
{{LuaIndexItem
 +
|page=readStringLocal
 +
|label=readStringLocal
 +
|description=Reads a null-terminated string from CE's memory.
 +
}}
 +
}}
  
 +
==== Writing to Target Process ====
 +
{{LuaIndexBox
 +
|title=Writing to Target Process
 +
|content=
 +
{{LuaIndexItem
 +
|page=writeBytes
 +
|label=writeBytes
 +
|description=Writes the given bytes (from a table) to the specified address in the target process.
 +
}}
 +
{{LuaIndexItem
 +
|page=writeSmallInteger
 +
|label=writeSmallInteger
 +
|description=Writes a 16-bit integer to the specified address. Returns true on success.
 +
}}
 +
{{LuaIndexItem
 +
|page=writeInteger
 +
|label=writeInteger
 +
|description=Writes a 32-bit integer to the specified address. Returns true on success.
 +
}}
 +
{{LuaIndexItem
 +
|page=writeQword
 +
|label=writeQword
 +
|description=Writes a 64-bit integer to the specified address. Returns true on success.
 +
}}
 +
{{LuaIndexItem
 +
|page=writeFloat
 +
|label=writeFloat
 +
|description=Writes a single-precision float to the specified address. Returns true on success.
 +
}}
 +
{{LuaIndexItem
 +
|page=writeDouble
 +
|label=writeDouble
 +
|description=Writes a double-precision float to the specified address. Returns true on success.
 +
}}
 +
{{LuaIndexItem
 +
|page=writeString
 +
|label=writeString
 +
|description=Writes a string to the specified address (typically null-terminated). Returns true on success.
 +
}}
 +
{{LuaIndexItem
 +
|page=writeRegionToFile
 +
|label=writeRegionToFile
 +
|description=Writes a memory region to a file. Returns the number of bytes written.
 +
}}
 +
}}
  
xmplayer_pause()
+
==== Writing to Cheat Engine Memory ====
Pauses the current xm audio file
+
{{LuaIndexBox
 +
|title=Writing to Cheat Engine Memory
 +
|content=
 +
{{LuaIndexItem
 +
|page=writeSmallIntegerLocal
 +
|label=writeSmallIntegerLocal
 +
|description=Writes a 16-bit integer to CE's memory. Returns true on success.
 +
}}
 +
{{LuaIndexItem
 +
|page=writeIntegerLocal
 +
|label=writeIntegerLocal
 +
|description=Writes a 32-bit integer to CE's memory. Returns true on success.
 +
}}
 +
{{LuaIndexItem
 +
|page=writeQwordLocal
 +
|label=writeQwordLocal
 +
|description=Writes a 64-bit integer to CE's memory. Returns true on success.
 +
}}
 +
{{LuaIndexItem
 +
|page=writeFloatLocal
 +
|label=writeFloatLocal
 +
|description=Writes a single-precision float to CE's memory. Returns true on success.
 +
}}
 +
{{LuaIndexItem
 +
|page=writeDoubleLocal
 +
|label=writeDoubleLocal
 +
|description=Writes a double-precision float to CE's memory. Returns true on success.
 +
}}
 +
{{LuaIndexItem
 +
|page=writeStringLocal
 +
|label=writeStringLocal
 +
|description=Writes a string to CE's memory. Returns true on success.
 +
}}
 +
{{LuaIndexItem
 +
|page=writeBytesLocal
 +
|label=writeBytesLocal
 +
|description=Writes the given bytes (from a table) to CE's memory.
 +
}}
 +
}}
  
 +
=== Conversions ===
  
xmplayer_resume()
+
==== Encoding/Decoding ====
Resumes the current xm audio file
+
{{LuaIndexBox
 +
|title=Encoding/Decoding
 +
|content=
 +
{{LuaIndexItem
 +
|page=ansiToUtf8
 +
|label=ansiToUtf8
 +
|description=Converts a string from ANSI encoding to UTF-8 encoding.
 +
}}
 +
{{LuaIndexItem
 +
|page=utf8ToAnsi
 +
|label=utf8ToAnsi
 +
|description=Converts a string from UTF-8 encoding to ANSI encoding.
 +
}}
 +
{{LuaIndexItem
 +
|page=stringToMD5String
 +
|label=stringToMD5String
 +
|description=Computes and returns the MD5 hash of a string as a hexadecimal string.
 +
}}
 +
{{LuaIndexItem
 +
|page=integerToUserData
 +
|label=integerToUserData
 +
|description=Converts a given integer to a userdata variable.
 +
}}
 +
{{LuaIndexItem
 +
|page=userDataToInteger
 +
|label=userDataToInteger
 +
|description=Converts a given userdata variable back to an integer.
 +
}}
 +
}}
  
 +
==== To Byte Table ====
 +
Convert data types into byte tables (tables of individual byte values).
 +
{{LuaIndexBox
 +
|title=To Byte Table
 +
|content=
 +
{{LuaIndexItem
 +
|page=wordToByteTable
 +
|label=wordToByteTable
 +
|description=Converts a 16-bit word to a byte table.
 +
}}
 +
{{LuaIndexItem
 +
|page=dwordToByteTable
 +
|label=dwordToByteTable
 +
|description=Converts a 32-bit dword to a byte table.
 +
}}
 +
{{LuaIndexItem
 +
|page=qwordToByteTable
 +
|label=qwordToByteTable
 +
|description=Converts a 64-bit qword to a byte table.
 +
}}
 +
{{LuaIndexItem
 +
|page=floatToByteTable
 +
|label=floatToByteTable
 +
|description=Converts a single-precision float to a byte table.
 +
}}
 +
{{LuaIndexItem
 +
|page=doubleToByteTable
 +
|label=doubleToByteTable
 +
|description=Converts a double-precision float to a byte table.
 +
}}
 +
{{LuaIndexItem
 +
|page=stringToByteTable
 +
|label=stringToByteTable
 +
|description=Converts a string (ANSI/UTF-8) to a byte table.
 +
}}
 +
{{LuaIndexItem
 +
|page=wideStringToByteTable
 +
|label=wideStringToByteTable
 +
|description=Converts a string to a wide string (Unicode) and then to a byte table.
 +
}}
 +
}}
  
xmplayer_stop()
+
==== From Byte Table ====
Stops the current xm audio file
+
Convert byte tables back into data types.
 +
{{LuaIndexBox
 +
|title=From Byte Table
 +
|content=
 +
{{LuaIndexItem
 +
|page=byteTableToWord
 +
|label=byteTableToWord
 +
|description=Converts a byte table to a 16-bit word.
 +
}}
 +
{{LuaIndexItem
 +
|page=byteTableToDword
 +
|label=byteTableToDword
 +
|description=Converts a byte table to a 32-bit dword.
 +
}}
 +
{{LuaIndexItem
 +
|page=byteTableToQword
 +
|label=byteTableToQword
 +
|description=Converts a byte table to a 64-bit qword.
 +
}}
 +
{{LuaIndexItem
 +
|page=byteTableToFloat
 +
|label=byteTableToFloat
 +
|description=Converts a byte table to a single-precision float.
 +
}}
 +
{{LuaIndexItem
 +
|page=byteTableToDouble
 +
|label=byteTableToDouble
 +
|description=Converts a byte table to a double-precision float.
 +
}}
 +
{{LuaIndexItem
 +
|page=byteTableToString
 +
|label=byteTableToString
 +
|description=Converts a byte table to a string.
 +
}}
 +
{{LuaIndexItem
 +
|page=byteTableToWideString
 +
|label=byteTableToWideString
 +
|description=Converts a byte table to a wide string (Unicode).
 +
}}
 +
}}
  
 +
==== Binary Operations ====
 +
Bitwise operations on integers.
 +
{{LuaIndexBox
 +
|title=Binary Operations
 +
|content=
 +
{{LuaIndexItem
 +
|page=bOr
 +
|label=bOr
 +
|description=Bitwise OR operation.
 +
}}
 +
{{LuaIndexItem
 +
|page=bXor
 +
|label=bXor
 +
|description=Bitwise XOR (exclusive OR) operation.
 +
}}
 +
{{LuaIndexItem
 +
|page=bAnd
 +
|label=bAnd
 +
|description=Bitwise AND operation.
 +
}}
 +
{{LuaIndexItem
 +
|page=bShl
 +
|label=bShl
 +
|description=Bitwise shift left operation.
 +
}}
 +
{{LuaIndexItem
 +
|page=bShr
 +
|label=bShr
 +
|description=Bitwise shift right operation.
 +
}}
 +
{{LuaIndexItem
 +
|page=bNot
 +
|label=bNot
 +
|description=Bitwise NOT (complement) operation.
 +
}}
 +
}}
  
xmplayer_isPlaying()
+
=== Input Devices ===
Returns true if there is current an xm audio file being played
 
  
 +
==== Keyboard & Mouse ====
 +
{{LuaIndexBox
 +
|title=Keyboard & Mouse
 +
|content=
 +
{{LuaIndexItem
 +
|page=getMousePos
 +
|label=getMousePos
 +
|description=Returns the current mouse cursor position as ''X'' and ''Y'' coordinates.
 +
}}
 +
{{LuaIndexItem
 +
|page=setMousePos
 +
|label=setMousePos
 +
|description=Sets the mouse cursor position to the specified ''X'' and ''Y'' coordinates.
 +
}}
 +
{{LuaIndexItem
 +
|page=isKeyPressed
 +
|label=isKeyPressed
 +
|description=Returns <code>true</code> if the specified key is currently held down.
 +
}}
 +
{{LuaIndexItem
 +
|page=keyDown
 +
|label=keyDown
 +
|description=Simulates pressing a key (puts the key into down state).
 +
}}
 +
{{LuaIndexItem
 +
|page=keyUp
 +
|label=keyUp
 +
|description=Simulates releasing a key (puts the key into up state).
 +
}}
 +
{{LuaIndexItem
 +
|page=doKeyPress
 +
|label=doKeyPress
 +
|description=Simulates a complete key press (down and up).
 +
}}
 +
{{LuaIndexItem
 +
|page=mouse_event
 +
|label=mouse_event
 +
|description=Calls the Windows API <code>mouse_event</code> directly for advanced mouse control. See [https://msdn.microsoft.com/en-us/library/windows/desktop/ms646260(v=vs.85).aspx MSDN documentation].
 +
}}
 +
{{LuaIndexItem
 +
|page=setGlobalKeyPollInterval
 +
|label=setGlobalKeyPollInterval
 +
|description=Sets the global key poll interval (frequency of keyboard state updates).
 +
}}
 +
{{LuaIndexItem
 +
|page=setGlobalDelayBetweenHotkeyActivation
 +
|label=setGlobalDelayBetweenHotkeyActivation
 +
|description=Sets the minimum delay (in milliseconds) between consecutive activations of the same hotkey.
 +
}}
 +
}}
  
writeRegionToFile(filename, sourceaddress,size)
+
==== Game Controller ====
Writes the given region to a file. Returns the number of bytes written
+
XBox/game controller input.
 +
{{LuaIndexBox
 +
|title=Game Controller
 +
|content=
 +
{{LuaIndexItem
 +
|page=getXBox360ControllerState
 +
|label=getXBox360ControllerState
 +
|description=Fetches the current state (buttons, triggers, sticks) of a connected XBox 360 controller.
 +
}}
 +
{{LuaIndexItem
 +
|page=setXBox360ControllerVibration
 +
|label=setXBox360ControllerVibration
 +
|description=Sets the speed of the left and right vibration motors in an XBox 360 controller (for haptic feedback).
 +
}}
 +
}}
  
 +
==== Clipboard ====
 +
{{LuaIndexBox
 +
|title=Clipboard
 +
|content=
 +
{{LuaIndexItem
 +
|page=writeToClipboard
 +
|label=writeToClipboard
 +
|description=Writes the given text to the system clipboard.
 +
}}
 +
}}
  
readRegionFromFile(filename, destinationaddress)
+
=== Screen ===
Writes the given file to a specific address
+
{{LuaIndexBox
 +
|title=Screen
 +
|content=
 +
{{LuaIndexItem
 +
|page=getScreenHeight
 +
|label=getScreenHeight
 +
|description=Returns the height of the screen in pixels.
 +
}}
 +
{{LuaIndexItem
 +
|page=getScreenWidth
 +
|label=getScreenWidth
 +
|description=Returns the width of the screen in pixels.
 +
}}
 +
{{LuaIndexItem
 +
|page=getScreenDPI
 +
|label=getScreenDPI
 +
|description=Returns the screen DPI (dots per inch) for determining screen scaling/density.
 +
}}
 +
{{LuaIndexItem
 +
|page=getWorkAreaHeight
 +
|label=getWorkAreaHeight
 +
|description=Returns the height of the usable work area (excludes taskbars).
 +
}}
 +
{{LuaIndexItem
 +
|page=getWorkAreaWidth
 +
|label=getWorkAreaWidth
 +
|description=Returns the width of the usable work area (excludes taskbars).
 +
}}
 +
{{LuaIndexItem
 +
|page=getScreenCanvas
 +
|label=getScreenCanvas
 +
|description=Returns a Canvas object for drawing directly to the screen. Limited usefulness in practice due to performance constraints.
 +
}}
 +
{{LuaIndexItem
 +
|page=getPixel
 +
|label=getPixel
 +
|description=Returns the RGB color value of a pixel at the specified screen coordinates.
 +
}}
 +
}}
  
 +
=== Sounds ===
  
resetLuaState()  
+
==== General Audio ====
This will create a new lua state that will be used. (Does not destroy the old one, so memory leak)
+
{{LuaIndexBox
 +
|title=General Audio
 +
|content=
 +
{{LuaIndexItem
 +
|page=playSound
 +
|label=playSound
 +
|description=Plays an audio file (supports various formats like .wav, .mp3, etc.).
 +
}}
 +
{{LuaIndexItem
 +
|page=beep
 +
|label=beep
 +
|description=Plays a system beep/ping sound.
 +
}}
 +
}}
  
 +
=== Text-to-Speech ===
 +
{{LuaIndexBox
 +
|title=Text-to-Speech
 +
|content=
 +
{{LuaIndexItem
 +
|page=speak
 +
|label=speak
 +
|description=Speaks the given text using the system's text-to-speech engine and optional flags. See [https://msdn.microsoft.com/en-us/library/speechplatform_speakflags.aspx MSDN SpeakFlags].
 +
}}
 +
{{LuaIndexItem
 +
|page=speakEnglish
 +
|label=speakEnglish
 +
|description=Speaks the given text using an English voice by wrapping it in an XML voice specification.
 +
}}
 +
}}
  
registerSymbol(symbolname, address)
+
==== XM Player ====
Assign the specified symbolname to an address
+
Plays tracked music (XM format) using the built-in XM player.
 +
{{LuaIndexBox
 +
|title=XM Player
 +
|content=
 +
{{LuaIndexItem
 +
|page=xmplayer_playXM
 +
|label=xmplayer_playXM
 +
|description=Plays an XM audio file given its filename.
 +
}}
 +
{{LuaIndexItem
 +
|page=xmplayer_pause
 +
|label=xmplayer_pause
 +
|description=Pauses the currently playing XM audio file.
 +
}}
 +
{{LuaIndexItem
 +
|page=xmplayer_resume
 +
|label=xmplayer_resume
 +
|description=Resumes playback of a paused XM audio file.
 +
}}
 +
{{LuaIndexItem
 +
|page=xmplayer_stop
 +
|label=xmplayer_stop
 +
|description=Stops XM audio playback completely.
 +
}}
 +
{{LuaIndexItem
 +
|page=xmplayer_isPlaying
 +
|label=xmplayer_isPlaying
 +
|description=Returns <code>true</code> if an XM audio file is currently being played.
 +
}}
 +
}}
  
 +
=== Fonts ===
 +
{{LuaIndexBox
 +
|title=Fonts
 +
|content=
 +
{{LuaIndexItem
 +
|page=loadFontFromStream
 +
|label=loadFontFromStream
 +
|description=Loads a font from a memory stream and returns a handle/ID for later use with <code>unloadLoadedFont</code>.
 +
}}
 +
{{LuaIndexItem
 +
|page=unloadLoadedFont
 +
|label=unloadLoadedFont
 +
|description=Unloads a previously loaded font by its handle/ID, freeing resources.
 +
}}
 +
}}
  
unregisterSymbol(symbolname)
+
=== Forms and Windows ===
Remove the name from the address
+
{{LuaIndexBox
 +
|title=Forms and Windows
 +
|content=
 +
{{LuaIndexItem
 +
|page=findWindow
 +
|label=findWindow
 +
|description=Finds a window by class name and/or window title/caption.
 +
}}
 +
{{LuaIndexItem
 +
|page=getWindow
 +
|label=getWindow
 +
|description=Gets a window handle based on a relative command (e.g. parent, child, next). See [https://msdn.microsoft.com/en-us/library/windows/desktop/ms633515(v=vs.85).aspx MSDN GetWindow].
 +
}}
 +
{{LuaIndexItem
 +
|page=getWindowCaption
 +
|label=getWindowCaption
 +
|description=Returns the caption/title text of the specified window.
 +
}}
 +
{{LuaIndexItem
 +
|page=getWindowClassName
 +
|label=getWindowClassName
 +
|description=Returns the class name of the specified window.
 +
}}
 +
{{LuaIndexItem
 +
|page=getWindowProcessID
 +
|label=getWindowProcessID
 +
|description=Returns the process ID (PID) of the process that owns the specified window.
 +
}}
 +
{{LuaIndexItem
 +
|page=getForegroundWindow
 +
|label=getForegroundWindow
 +
|description=Returns the handle of the topmost (foreground) window currently active.
 +
}}
 +
{{LuaIndexItem
 +
|page=sendMessage
 +
|label=sendMessage
 +
|description=Sends a Windows message to the specified window.
 +
}}
 +
{{LuaIndexItem
 +
|page=hookWndProc
 +
|label=hookWndProc
 +
|description=Hooks a window's window procedure (WndProc) to intercept and handle messages.
 +
}}
 +
{{LuaIndexItem
 +
|page=unhookWndProc
 +
|label=unhookWndProc
 +
|description=Uninstalls a WndProc hook previously installed via <code>hookWndProc</code>.
 +
}}
 +
}}
  
 +
=== Cheat Engine ===
 +
Functions for managing and controlling Cheat Engine itself.
  
getNameFromAddress(address)
+
==== Version and Information ====
Returns the given address in string form, returning the symbol representation if possible
+
{{LuaIndexBox
 +
|title=Version and Information
 +
|content=
 +
{{LuaIndexItem
 +
|page=getCEVersion
 +
|label=getCEVersion
 +
|description=Returns the Cheat Engine version as a floating-point number (e.g. <code>7.5</code>).
 +
}}
 +
{{LuaIndexItem
 +
|page=getCheatEngineFileVersion
 +
|label=getCheatEngineFileVersion
 +
|description=Returns full version information: a raw integer and a table containing major, minor, release, and build numbers.
 +
}}
 +
{{LuaIndexItem
 +
|page=cheatEngineIs64Bit
 +
|label=cheatEngineIs64Bit
 +
|description=Returns <code>true</code> if Cheat Engine is running as 64-bit; <code>false</code> if 32-bit.
 +
}}
 +
{{LuaIndexItem
 +
|page=getCheatEngineProcessID
 +
|label=getCheatEngineProcessID
 +
|description=Returns the process ID of the Cheat Engine process itself.
 +
}}
 +
{{LuaIndexItem
 +
|page=getCheatEngineDir
 +
|label=getCheatEngineDir
 +
|description=Returns the folder path where Cheat Engine (or the current trainer) is located.
 +
}}
 +
}}
  
 +
==== Management ====
 +
{{LuaIndexBox
 +
|title=Management
 +
|content=
 +
{{LuaIndexItem
 +
|page=closeCE
 +
|label=closeCE
 +
|description=Closes Cheat Engine.
 +
}}
 +
{{LuaIndexItem
 +
|page=getFreezeTimer
 +
|label=getFreezeTimer
 +
|description=Returns the Timer object responsible for freezing/unfreezing values in the address list.
 +
}}
 +
{{LuaIndexItem
 +
|page=getUpdateTimer
 +
|label=getUpdateTimer
 +
|description=Returns the Timer object responsible for updating displayed values in the address list.
 +
}}
 +
{{LuaIndexItem
 +
|page=getCommonModuleList
 +
|label=getCommonModuleList
 +
|description=Returns the common module list as a [[Lua:Class:StringList|StringList]] object.
 +
}}
 +
{{LuaIndexItem
 +
|page=getAutoAttachList
 +
|label=getAutoAttachList
 +
|description=Returns the AutoAttach list as a [[Lua:Class:StringList|StringList]] object.
 +
}}
 +
{{LuaIndexItem
 +
|page=connectToCEServer
 +
|label=connectToCEServer
 +
|description=Connects to a remote Cheat Engine server (given host and port). Subsequent operations route through the server.
 +
}}
 +
{{LuaIndexItem
 +
|page=reloadSettingsFromRegistry
 +
|label=reloadSettingsFromRegistry
 +
|description=Reloads Cheat Engine settings from the registry and applies them immediately.
 +
}}
 +
{{LuaIndexItem
 +
|page=loadPlugin
 +
|label=loadPlugin
 +
|description=Loads the specified plugin.
 +
}}
 +
{{LuaIndexItem
 +
|page=getSettings
 +
|label=getSettings
 +
|description=Returns the settings object for accessing/modifying CE configuration.
 +
}}
 +
{{LuaIndexItem
 +
|page=registerBinUtil
 +
|label=registerBinUtil
 +
|description=Registers a binutils (assembler/disassembler) toolset with Cheat Engine.
 +
}}
 +
}}
  
inModule(address)
+
==== Comments and Headers ====
Returns true if the given address is inside a module
+
{{LuaIndexBox
 +
|title=Comments and Headers
 +
|content=
 +
{{LuaIndexItem
 +
|page=getComment
 +
|label=getComment
 +
|description=Gets the user-defined comment attached to the specified address.
 +
}}
 +
{{LuaIndexItem
 +
|page=setComment
 +
|label=setComment
 +
|description=Sets a user-defined comment at the specified address.
 +
}}
 +
{{LuaIndexItem
 +
|page=getHeader
 +
|label=getHeader
 +
|description=Gets the user-defined header text at the specified address.
 +
}}
 +
{{LuaIndexItem
 +
|page=setHeader
 +
|label=setHeader
 +
|description=Sets a user-defined header text at the specified address.
 +
}}
 +
}}
  
 +
==== Advertising and Support ====
 +
{{LuaIndexBox
 +
|title=Advertising and Support
 +
|content=
 +
{{LuaIndexItem
 +
|page=supportCheatEngine
 +
|label=supportCheatEngine
 +
|description=Displays an advertising/support window to help fund Cheat Engine development.
 +
}}
 +
{{LuaIndexItem
 +
|page=fuckCheatEngine
 +
|label=fuckCheatEngine
 +
|description=Hides/closes the advertising window if it was showing (crude but functional name).
 +
}}
 +
}}
  
inSystemModule(address)
+
==== Forms and UI ====
Returns true if the given address is inside a system module
+
{{LuaIndexBox
 +
|title=Forms and UI
 +
|content=
 +
{{LuaIndexItem
 +
|page=getFormCount
 +
|label=getFormCount
 +
|description=Returns the total number of forms currently attached to the main CE application.
 +
}}
 +
{{LuaIndexItem
 +
|page=getForm
 +
|label=getForm
 +
|description=Returns the form object at the specified index (0-based).
 +
}}
 +
{{LuaIndexItem
 +
|page=getMemoryViewForm
 +
|label=getMemoryViewForm
 +
|description=Returns the first MemoryView form object (the hex editor window).
 +
}}
 +
{{LuaIndexItem
 +
|page=getMainForm
 +
|label=getMainForm
 +
|description=Returns the main Cheat Engine window form object.
 +
}}
 +
{{LuaIndexItem
 +
|page=getSettingsForm
 +
|label=getSettingsForm
 +
|description=Returns the settings/options dialog form object.
 +
}}
 +
{{LuaIndexItem
 +
|page=getLuaEngine
 +
|label=getLuaEngine
 +
|description=Returns the Lua engine/console form object (creates it if needed).
 +
}}
 +
{{LuaIndexItem
 +
|page=unhideMainCEwindow
 +
|label=unhideMainCEwindow
 +
|description=Shows the main Cheat Engine window (opposite of <code>hideAllCEWindows</code>).
 +
}}
 +
{{LuaIndexItem
 +
|page=hideAllCEWindows
 +
|label=hideAllCEWindows
 +
|description=Hides all normal Cheat Engine windows (e.g. the trainer table UI).
 +
}}
 +
{{LuaIndexItem
 +
|page=registerFormAddNotification
 +
|label=registerFormAddNotification
 +
|description=Registers a callback function invoked when a form is added to CE's form list.
 +
}}
 +
{{LuaIndexItem
 +
|page=unregisterFormAddNotification
 +
|label=unregisterFormAddNotification
 +
|description=Unregisters a previously registered form add notification callback.
 +
}}
 +
}}
  
 +
==== Messages ====
 +
{{LuaIndexBox
 +
|title=Messages
 +
|content=
 +
{{LuaIndexItem
 +
|page=showMessage
 +
|label=showMessage
 +
|description=Shows a simple message box with the given text to the user.
 +
}}
 +
{{LuaIndexItem
 +
|page=messageDialog
 +
|label=messageDialog
 +
|description=Pops up a message dialog box (similar to <code>showMessage</code>, with more control over buttons/options).
 +
}}
 +
{{LuaIndexItem
 +
|page=outputDebugString
 +
|label=outputDebugString
 +
|description=Outputs a message using the Windows <code>OutputDebugString</code> API (visible in debuggers).
 +
}}
 +
{{LuaIndexItem
 +
|page=processMessages
 +
|label=processMessages
 +
|description=Processes pending window messages in the event queue, allowing button clicks and UI updates to be handled.
 +
}}
 +
}}
  
getCommonModuleList()
+
==== Input ====
Returns the commonModuleList StringList object. (Do not free this one)
+
{{LuaIndexBox
You can use it to add or remove modules you do not want to scan by routines like dissect code and the pointerscan
+
|title=Input
 +
|content=
 +
{{LuaIndexItem
 +
|page=inputQuery
 +
|label=inputQuery
 +
|description=Shows a dialog prompting the user to input a string. Returns the entered string, or <code>nil</code> if cancelled (CE 6.4+).
 +
}}
 +
}}
  
 +
==== Shortcuts ====
 +
{{LuaIndexBox
 +
|title=Shortcuts
 +
|content=
 +
{{LuaIndexItem
 +
|page=shortCutToText
 +
|label=shortCutToText
 +
|description=Converts a shortcut integer value to its textual representation (e.g. <code>"Ctrl+Alt+A"</code>). (CE 6.4+)
 +
}}
 +
{{LuaIndexItem
 +
|page=textToShortCut
 +
|label=textToShortCut
 +
|description=Converts a text representation (e.g. <code>"Ctrl+Alt+A"</code>) to a shortcut integer value. (CE 6.4+)
 +
}}
 +
{{LuaIndexItem
 +
|page=convertKeyComboToString
 +
|label=convertKeyComboToString
 +
|description=Converts a key combination to its string representation, matching the hotkey handler's format.
 +
}}
 +
}}
  
cheatEngineIs64Bit()
+
==== Speed Hack ====
Returns true if CE is 64-bit, false if 32-bit
+
{{LuaIndexBox
 +
|title=Speed Hack
 +
|content=
 +
{{LuaIndexItem
 +
|page=speedhack_setSpeed
 +
|label=speedhack_setSpeed
 +
|description=Enables the speed hack (if not already active) and sets the game/process speed multiplier (e.g. <code>2.0</code> for 2x speed).
 +
}}
 +
{{LuaIndexItem
 +
|page=speedhack_getSpeed
 +
|label=speedhack_getSpeed
 +
|description=Returns the current speed hack multiplier value that was last set.
 +
}}
 +
}}
  
 +
=== Lua ===
 +
Functions for managing the Lua engine and state.
  
targetIs64Bit()
+
{{LuaIndexBox
Returns true if the target process is 64-bit, false if 32-bit
+
|title=Lua
 +
|content=
 +
{{LuaIndexItem
 +
|page=resetLuaState
 +
|label=resetLuaState
 +
|description=Creates a fresh Lua state, resetting the environment and clearing all previously defined variables/functions.
 +
}}
 +
{{LuaIndexItem
 +
|page=sleep
 +
|label=sleep
 +
|description=Pauses execution for the specified number of milliseconds.
 +
}}
 +
{{LuaIndexItem
 +
|page=createRef
 +
|label=createRef
 +
|description=Creates and returns an integer reference handle that can store and retrieve Lua objects persistently.
 +
}}
 +
{{LuaIndexItem
 +
|page=getRef
 +
|label=getRef
 +
|description=Retrieves the Lua value/object referenced by the given reference handle.
 +
}}
 +
{{LuaIndexItem
 +
|page=destroyRef
 +
|label=destroyRef
 +
|description=Destroys and frees a reference handle, removing the reference and allowing garbage collection.
 +
}}
 +
}}
  
 +
=== Types ===
 +
Functions for registering and managing custom data types.
  
registerCustomTypeLua(typename, bytecount, bytestovaluefunction, valuetobytesfunction)
+
{{LuaIndexBox
Registers a Custom type based on lua functions
+
|title=Types
  The bytes to value function should be defined as "function bytestovalue (b1,b2,b3,b4)" and return an integer as result
+
|content=
  The value to bytes function should be defined as "function valuetobytes (integer)" and return the bytes it should write
+
{{LuaIndexItem
 +
|page=onAutoGuess
 +
|label=onAutoGuess
 +
|description=Registers a callback function invoked by Cheat Engine's auto-guess feature to predict and suggest variable types.
 +
}}
 +
{{LuaIndexItem
 +
|page=registerCustomTypeLua
 +
|label=registerCustomTypeLua
 +
|description=Registers a custom data type defined using Lua functions for reading/writing/display logic.
 +
}}
 +
{{LuaIndexItem
 +
|page=registerCustomTypeAutoAssembler
 +
|label=registerCustomTypeAutoAssembler
 +
|description=Registers a custom data type defined using an Auto Assembler script.
 +
}}
 +
}}
  
 +
=== Object-oriented ===
 +
Functions for determining class inheritance and type relationships.
  
 +
{{LuaIndexBox
 +
|title=Object-oriented
 +
|content=
 +
{{LuaIndexItem
 +
|page=inheritsFromObject
 +
|label=inheritsFromObject
 +
|description=Returns <code>true</code> if the given object is a valid Cheat Engine class instance (inherits from Object).
 +
}}
 +
{{LuaIndexItem
 +
|page=inheritsFromComponent
 +
|label=inheritsFromComponent
 +
|description=Returns <code>true</code> if the given object inherits from the Component class.
 +
}}
 +
{{LuaIndexItem
 +
|page=inheritsFromControl
 +
|label=inheritsFromControl
 +
|description=Returns <code>true</code> if the given object inherits from the Control class (UI controls).
 +
}}
 +
{{LuaIndexItem
 +
|page=inheritsFromWinControl
 +
|label=inheritsFromWinControl
 +
|description=Returns <code>true</code> if the given object inherits from the WinControl class (windowed controls).
 +
}}
 +
}}
  
 +
=== Assembly ===
 +
Functions for working with x86/x64 machine code and assembly instructions.
  
registerCustomTypeAutoAssembler(typename, bytecount, script)
+
{{LuaIndexBox
Registers a custom type based on an auto assembler script. The script must allocate an "ConvertRoutine" and "ConvertBackRoutine"
+
|title=Assembly
 +
|content=
 +
{{LuaIndexItem
 +
|page=autoAssemble
 +
|label=autoAssemble
 +
|description=Executes an Auto Assembler script (given as text) for code injection, patching, or other assembly operations.
 +
}}
 +
{{LuaIndexItem
 +
|page=autoAssembleCheck
 +
|label=autoAssembleCheck
 +
|description=Validates an Auto Assembler script for syntax errors. Returns <code>true</code> on success; <code>false</code> with error message on failure.
 +
}}
 +
{{LuaIndexItem
 +
|page=disassemble
 +
|label=disassemble
 +
|description=Disassembles the instruction at the given address and returns a formatted string: <code>"address - bytes - opcode  extra"</code>.
 +
}}
 +
{{LuaIndexItem
 +
|page=splitDisassembledString
 +
|label=splitDisassembledString
 +
|description=Parses a disassembled instruction string and returns 4 separate strings: address, bytes, opcode, and extra field.
 +
}}
 +
{{LuaIndexItem
 +
|page=getInstructionSize
 +
|label=getInstructionSize
 +
|description=Returns the size (in bytes) of the instruction at the given address.
 +
}}
 +
{{LuaIndexItem
 +
|page=getPreviousOpcode
 +
|label=getPreviousOpcode
 +
|description=Attempts to find and return the address of the previous instruction (heuristic guess).
 +
}}
 +
{{LuaIndexItem
 +
|page=registerAssembler
 +
|label=registerAssembler
 +
|description=Registers a custom callback function for the single-line assembler to convert instruction mnemonics to bytes.
 +
}}
 +
{{LuaIndexItem
 +
|page=unregisterAssembler
 +
|label=unregisterAssembler
 +
|description=Unregisters a previously registered custom assembler callback.
 +
}}
 +
}}
  
 +
=== Auto Assembler ===
  
onAutoGuess(function)
+
==== Commands & Hooks ====
Registers an function to be called whenever autoguess is used to predict a variable type
+
{{LuaIndexBox
function override (address, ceguess): Return the variable type you want it to be. If no change, just return ceguess
+
|title=Commands & Hooks
 +
|content=
 +
{{LuaIndexItem
 +
|page=registerAutoAssemblerCommand
 +
|label=registerAutoAssemblerCommand
 +
|description=Registers a custom Auto Assembler command that calls the specified Lua function when invoked in a script.
 +
}}
 +
{{LuaIndexItem
 +
|page=unregisterAutoAssemblerCommand
 +
|label=unregisterAutoAssemblerCommand
 +
|description=Unregisters a previously registered Auto Assembler command.
 +
}}
 +
{{LuaIndexItem
 +
|page=registerAutoAssemblerPrologue
 +
|label=registerAutoAssemblerPrologue
 +
|description=Registers a callback function invoked before the Auto Assembler parses a script (prologue phase).
 +
}}
 +
{{LuaIndexItem
 +
|page=unregisterAutoAssemblerPrologue
 +
|label=unregisterAutoAssemblerPrologue
 +
|description=Unregisters an Auto Assembler prologue callback.
 +
}}
 +
{{LuaIndexItem
 +
|page=fullAccess
 +
|label=fullAccess
 +
|description=Changes memory protection on a block of memory to be writable and executable.
 +
}}
 +
}}
  
 +
==== Scripts & Templates ====
 +
{{LuaIndexBox
 +
|title=Scripts & Templates
 +
|content=
 +
{{LuaIndexItem
 +
|page=registerAutoAssemblerTemplate
 +
|label=registerAutoAssemblerTemplate
 +
|description=Registers a reusable template for the Auto Assembler script generator.
 +
}}
 +
{{LuaIndexItem
 +
|page=unregisterAutoAssemblerTemplate
 +
|label=unregisterAutoAssemblerTemplate
 +
|description=Unregisters a previously registered Auto Assembler template.
 +
}}
 +
{{LuaIndexItem
 +
|page=generateCodeInjectionScript
 +
|label=generateCodeInjectionScript
 +
|description=Generates and appends a default code injection script to the provided script (allocates space, injects code, patches original).
 +
}}
 +
{{LuaIndexItem
 +
|page=generateAOBInjectionScript
 +
|label=generateAOBInjectionScript
 +
|description=Generates and appends an Array-of-Bytes (AOB) injection script to the provided script (searches for pattern, injects code).
 +
}}
 +
{{LuaIndexItem
 +
|page=generateFullInjectionScript
 +
|label=generateFullInjectionScript
 +
|description=Generates and appends a complete full injection script with all patches and cleanup code.
 +
}}
 +
{{LuaIndexItem
 +
|page=generateAPIHookScript
 +
|label=generateAPIHookScript
 +
|description=Generates an Auto Assembler script that hooks (intercepts) the given API function address.
 +
}}
 +
}}
  
 +
=== Debugger ===
 +
Functions for managing the debugger. See [[Lua Debugging]] for detailed information.
  
 +
==== Status and Information ====
 +
{{LuaIndexBox
 +
|title=Status and Information
 +
|content=
 +
{{LuaIndexItem
 +
|page=debug_isDebugging
 +
|label=debug_isDebugging
 +
|description=Returns <code>true</code> if the debugger has been started and is active.
 +
}}
 +
{{LuaIndexItem
 +
|page=debug_getCurrentDebuggerInterface
 +
|label=debug_getCurrentDebuggerInterface
 +
|description=Returns the current debugger interface type: <code>1</code>=Windows, <code>2</code>=VEH, <code>3</code>=Kernel, <code>nil</code>=no debugging.
 +
}}
 +
{{LuaIndexItem
 +
|page=debug_canBreak
 +
|label=debug_canBreak
 +
|description=Returns <code>true</code> if the target process can stop on a breakpoint. (CE 6.4+)
 +
}}
 +
{{LuaIndexItem
 +
|page=debug_isBroken
 +
|label=debug_isBroken
 +
|description=Returns <code>true</code> if the debugger is currently halted on a thread (at a breakpoint).
 +
}}
 +
{{LuaIndexItem
 +
|page=debug_getBreakpointList
 +
|label=debug_getBreakpointList
 +
|description=Returns a Lua table containing all currently active breakpoint addresses.
 +
}}
 +
}}
  
 +
==== Breakpoint Management ====
 +
{{LuaIndexBox
 +
|title=Breakpoint Management
 +
|content=
 +
{{LuaIndexItem
 +
|page=debugProcess
 +
|label=debugProcess
 +
|description=Starts debugging the currently attached process.
 +
}}
 +
{{LuaIndexItem
 +
|page=debug_setBreakpoint
 +
|label=debug_setBreakpoint
 +
|description=Sets a breakpoint of a specific size (in bytes) at the given address.
 +
}}
 +
{{LuaIndexItem
 +
|page=debug_removeBreakpoint
 +
|label=debug_removeBreakpoint
 +
|description=Removes a breakpoint at the specified address.
 +
}}
 +
{{LuaIndexItem
 +
|page=debug_continueFromBreakpoint
 +
|label=debug_continueFromBreakpoint
 +
|description=Resumes execution when the debugger is halted on a breakpoint.
 +
}}
 +
{{LuaIndexItem
 +
|page=debug_addThreadToNoBreakList
 +
|label=debug_addThreadToNoBreakList
 +
|description=Adds a thread to the no-break list so breakpoints on it will be ignored.
 +
}}
 +
{{LuaIndexItem
 +
|page=debug_removeThreadFromNoBreakList
 +
|label=debug_removeThreadFromNoBreakList
 +
|description=Removes a thread from the no-break list.
 +
}}
 +
}}
  
 +
==== Callbacks ====
 +
{{LuaIndexBox
 +
|title=Callbacks
 +
|content=
 +
{{LuaIndexItem
 +
|page=debugger_onBreakpoint
 +
|label=debugger_onBreakpoint
 +
|description=User-defined callback invoked by CE when a breakpoint is hit (define your own implementation).
 +
}}
 +
{{LuaIndexItem
 +
|page=debugger_onModuleLoad
 +
|label=debugger_onModuleLoad
 +
|description=User-defined callback invoked by the Windows debugger when a module is loaded.
 +
}}
 +
}}
  
 +
==== Register and Context Management ====
 +
{{LuaIndexBox
 +
|title=Register and Context Management
 +
|content=
 +
{{LuaIndexItem
 +
|page=debug_getContext
 +
|label=debug_getContext
 +
|description=Force-updates the Lua variables representing CPU registers from the current thread context. (CE 6.5+)
 +
}}
 +
{{LuaIndexItem
 +
|page=debug_setContext
 +
|label=debug_setContext
 +
|description=Force-updates the CPU registers from the Lua variables representing them. (CE 6.5+)
 +
}}
 +
{{LuaIndexItem
 +
|page=debug_updateGUI
 +
|label=debug_updateGUI
 +
|description=Refreshes the UI to reflect the current debug context if the debugger is broken.
 +
}}
 +
{{LuaIndexItem
 +
|page=debug_getXMMPointer
 +
|label=debug_getXMMPointer
 +
|description=Returns the memory address of the specified XMM register for the currently broken thread.
 +
}}
 +
}}
  
 +
==== Advanced Debugging ====
 +
{{LuaIndexBox
 +
|title=Advanced Debugging
 +
|content=
 +
{{LuaIndexItem
 +
|page=debug_setLastBranchRecording
 +
|label=debug_setLastBranchRecording
 +
|description=Tells the kernel-mode debugger to record the last few branch/jump instructions before a breakpoint is hit.
 +
}}
 +
{{LuaIndexItem
 +
|page=debug_getMaxLastBranchRecord
 +
|label=debug_getMaxLastBranchRecord
 +
|description=Returns the maximum number of branch records this CPU supports.
 +
}}
 +
{{LuaIndexItem
 +
|page=debug_getLastBranchRecord
 +
|label=debug_getLastBranchRecord
 +
|description=Returns the Last Branch Record value at the given index (when handling a breakpoint with branch recording enabled).
 +
}}
 +
{{LuaIndexItem
 +
|page=detachIfPossible
 +
|label=detachIfPossible
 +
|description=Detaches the debugger from the target process if possible.
 +
}}
 +
}}
  
Debugging
+
=== DBK (Driver-Based Kernel) ===
 +
Functions for kernel-mode operations via the DBK driver.
  
 +
==== Initialization and Setup ====
 +
{{LuaIndexBox
 +
|title=Initialization and Setup
 +
|content=
 +
{{LuaIndexItem
 +
|page=dbk_initialize
 +
|label=dbk_initialize
 +
|description=Loads and initializes the DBK kernel driver into memory if possible.
 +
}}
 +
{{LuaIndexItem
 +
|page=dbk_useKernelmodeOpenProcess
 +
|label=dbk_useKernelmodeOpenProcess
 +
|description=Redirects <code>OpenProcess</code> API calls to use kernel-mode DBK equivalents.
 +
}}
 +
{{LuaIndexItem
 +
|page=dbk_useKernelmodeProcessMemoryAccess
 +
|label=dbk_useKernelmodeProcessMemoryAccess
 +
|description=Redirects <code>ReadProcessMemory</code> and <code>WriteProcessMemory</code> to use kernel-mode DBK versions.
 +
}}
 +
{{LuaIndexItem
 +
|page=dbk_useKernelmodeQueryMemoryRegions
 +
|label=dbk_useKernelmodeQueryMemoryRegions
 +
|description=Redirects virtual memory query APIs to use kernel-mode DBK equivalents.
 +
}}
 +
}}
  
debug variables
+
==== Process and Thread Information ====
EFLAGS
+
{{LuaIndexBox
32-bit EAX, EBX, ECX, EDX, EDI, ESP, EBP, ESP, EIP
+
|title=Process and Thread Information
64-bit RAX, EBX, RBX, RDX, RDI, RSP, RBP, RSP, RIP, R8, R9, R10, R11, R12, R13, R14, R15  The value of the register
+
|content=
 +
{{LuaIndexItem
 +
|page=dbk_getPEProcess
 +
|label=dbk_getPEProcess
 +
|description=Returns the kernel pointer to the EPROCESS structure of the selected process ID.
 +
}}
 +
{{LuaIndexItem
 +
|page=dbk_getPEThread
 +
|label=dbk_getPEThread
 +
|description=Returns the kernel pointer to the ETHREAD structure of a given thread ID.
 +
}}
 +
}}
  
 +
==== CPU Register Access ====
 +
{{LuaIndexBox
 +
|title=CPU Register Access
 +
|content=
 +
{{LuaIndexItem
 +
|page=dbk_readMSR
 +
|label=dbk_readMSR
 +
|description=Reads a Model-Specific Register (MSR) using the DBK driver.
 +
}}
 +
{{LuaIndexItem
 +
|page=dbk_writeMSR
 +
|label=dbk_writeMSR
 +
|description=Writes a Model-Specific Register (MSR) using the DBK driver.
 +
}}
 +
{{LuaIndexItem
 +
|page=dbk_getCR0
 +
|label=dbk_getCR0
 +
|description=Returns the value of Control Register 0 (CR0).
 +
}}
 +
{{LuaIndexItem
 +
|page=dbk_getCR3
 +
|label=dbk_getCR3
 +
|description=Returns the value of Control Register 3 (CR3) for the currently opened process.
 +
}}
 +
{{LuaIndexItem
 +
|page=dbk_getCR4
 +
|label=dbk_getCR4
 +
|description=Returns the value of Control Register 4 (CR4).
 +
}}
 +
}}
  
Debug related routines
+
==== Memory and Execution ====
function debugger_onBreakpoint()
+
{{LuaIndexBox
When a breaking breakpoint hits (that includes single stepping) and the lua function debugger_onBreakpoint() is defined it will be called and the global variables EAX, EBX, .... will be filled in
+
|title=Memory and Execution
Return 0 if you want the userinterface to be updated and anything else if not (e.g You continued from the breakpoint in your script)
+
|content=
 +
{{LuaIndexItem
 +
|page=dbk_getPhysicalAddress
 +
|label=dbk_getPhysicalAddress
 +
|description=Converts a virtual address to its physical address using the DBK driver.
 +
}}
 +
{{LuaIndexItem
 +
|page=dbk_executeKernelMemory
 +
|label=dbk_executeKernelMemory
 +
|description=Executes a routine from kernel mode (e.g. injected code written with Auto Assembler).
 +
}}
 +
{{LuaIndexItem
 +
|page=dbk_writesIgnoreWriteProtection
 +
|label=dbk_writesIgnoreWriteProtection
 +
|description=When set to <code>true</code>, write operations bypass copy-on-write behavior.
 +
}}
 +
}}
  
 +
=== DBVM ===
 +
Functions for hypervisor-based operations and advanced memory monitoring via DBVM.
  
 +
==== Initialization ====
 +
{{LuaIndexBox
 +
|title=Initialization
 +
|content=
 +
{{LuaIndexItem
 +
|page=dbvm_initialize
 +
|label=dbvm_initialize
 +
|description=Initializes the DBVM hypervisor functions for use.
 +
}}
 +
}}
  
 +
==== Memory Operations ====
 +
{{LuaIndexBox
 +
|title=Memory Operations
 +
|content=
 +
{{LuaIndexItem
 +
|page=dbvm_addMemory
 +
|label=dbvm_addMemory
 +
|description=Adds a memory region to DBVM.
 +
}}
 +
{{LuaIndexItem
 +
|page=dbvm_readPhysicalMemory
 +
|label=dbvm_readPhysicalMemory
 +
|description=Reads physical memory directly using DBVM (hypervisor-level access).
 +
}}
 +
{{LuaIndexItem
 +
|page=dbvm_writePhysicalMemory
 +
|label=dbvm_writePhysicalMemory
 +
|description=Writes physical memory directly using DBVM (hypervisor-level access).
 +
}}
 +
}}
  
createProcess(path, parameters OPTIONAL, debug OPTIONAL, breakonentrypoint OPTIONAL)
+
==== MSR and Control Register Access ====
Creates a process. If debug is true it will be created using the windows debugger and if breakonentry is true it will cause a breakpoint to occur on entrypoint
+
{{LuaIndexBox
 +
|title=MSR and Control Register Access
 +
|content=
 +
{{LuaIndexItem
 +
|page=dbvm_readMSR
 +
|label=dbvm_readMSR
 +
|description=Reads a Model-Specific Register (MSR) using DBVM (bypasses driver).
 +
}}
 +
{{LuaIndexItem
 +
|page=dbvm_writeMSR
 +
|label=dbvm_writeMSR
 +
|description=Writes a Model-Specific Register (MSR) using DBVM (bypasses driver).
 +
}}
 +
{{LuaIndexItem
 +
|page=dbvm_getCR4
 +
|label=dbvm_getCR4
 +
|description=Returns the real (unhooked) value of Control Register 4 (CR4).
 +
}}
 +
}}
  
 +
==== Memory Monitoring ====
 +
{{LuaIndexBox
 +
|title=Memory Monitoring
 +
|content=
 +
{{LuaIndexItem
 +
|page=dbvm_watch_writes
 +
|label=dbvm_watch_writes
 +
|description=Starts monitoring write accesses to a memory region.
 +
}}
 +
{{LuaIndexItem
 +
|page=dbvm_watch_reads
 +
|label=dbvm_watch_reads
 +
|description=Starts monitoring read accesses to a memory region.
 +
}}
 +
{{LuaIndexItem
 +
|page=dbvm_watch_retrievelog
 +
|label=dbvm_watch_retrievelog
 +
|description=Retrieves the log/results of memory region monitoring (reads or writes).
 +
}}
 +
{{LuaIndexItem
 +
|page=dbvm_watch_disable
 +
|label=dbvm_watch_disable
 +
|description=Stops memory region monitoring.
 +
}}
 +
}}
  
debugProcess(interface OPT)
+
==== Memory Cloaking ====
Starts the debugger for the currently opened process (won't ask the user)  
+
{{LuaIndexBox
  Optional interface 0=default, 1=windows debug, 2=VEHDebug, 3=Kerneldebug
+
|title=Memory Cloaking
 +
|content=
 +
{{LuaIndexItem
 +
|page=dbvm_cloak_activate
 +
|label=dbvm_cloak_activate
 +
|description=Cloaks a memory page so modifications become invisible to the target process.
 +
}}
 +
{{LuaIndexItem
 +
|page=dbvm_cloak_deactivate
 +
|label=dbvm_cloak_deactivate
 +
|description=Disables cloaking on a page and undoes hidden modifications.
 +
}}
 +
{{LuaIndexItem
 +
|page=dbvm_cloak_readOriginal
 +
|label=dbvm_cloak_readOriginal
 +
|description=Reads the original (hidden) memory contents of a cloaked region.
 +
}}
 +
{{LuaIndexItem
 +
|page=dbvm_cloak_writeOriginal
 +
|label=dbvm_cloak_writeOriginal
 +
|description=Writes to the original (hidden) memory contents of a cloaked region.
 +
}}
 +
}}
  
 +
==== Breakpoints and Debugging ====
 +
{{LuaIndexBox
 +
|title=Breakpoints and Debugging
 +
|content=
 +
{{LuaIndexItem
 +
|page=dbvm_changeregonbp
 +
|label=dbvm_changeregonbp
 +
|description=Cloaks a page, sets a breakpoint at the given address, and modifies registers when the breakpoint is hit.
 +
}}
 +
{{LuaIndexItem
 +
|page=dbvm_removechangeregonbp
 +
|label=dbvm_removechangeregonbp
 +
|description=Removes a "change registers on breakpoint" breakpoint.
 +
}}
 +
}}
  
debug_setBreakpoint(address, size OPTIONAL, trigger OPTIONAL)
+
==== CR3 (Process Context) Logging ====
Sets a breakpoint of a specific size at the given address. if trigger is bptExecute then size is ignored. If trigger is ignored then it will be of type bptExecute, which obviously also ignores the size then as well
+
{{LuaIndexBox
 +
|title=CR3 (Process Context) Logging
 +
|content=
 +
{{LuaIndexItem
 +
|page=dbvm_log_cr3_start
 +
|label=dbvm_log_cr3_start
 +
|description=Starts logging all CR3 (process context/page directory) changes.
 +
}}
 +
{{LuaIndexItem
 +
|page=dbvm_log_cr3_stop
 +
|label=dbvm_log_cr3_stop
 +
|description=Stops CR3 logging.
 +
}}
 +
}}
  
 +
==== Performance and Anti-Detection ====
 +
{{LuaIndexBox
 +
|title=Performance and Anti-Detection
 +
|content=
 +
{{LuaIndexItem
 +
|page=dbvm_speedhack_setSpeed
 +
|label=dbvm_speedhack_setSpeed
 +
|description=Sets system-wide speed hack via DBVM (affects all processes).
 +
}}
 +
{{LuaIndexItem
 +
|page=dbvm_setTSCAdjust
 +
|label=dbvm_setTSCAdjust
 +
|description=Configures TSC (Time Stamp Counter) adjustment to bypass VM detection (RDTSC hooks).
 +
}}
 +
}}
  
debug_removeBreakpoint(address)
+
=== Translation ===
If the given address is a part of a breakpoint it will be removed
+
{{LuaIndexBox
 +
|title=Translation
 +
|content=
 +
{{LuaIndexItem
 +
|page=getTranslationFolder
 +
|label=getTranslationFolder
 +
|description=Returns the path to the current translation files. Returns an empty string if no translation is active.
 +
}}
 +
{{LuaIndexItem
 +
|page=loadPOFile
 +
|label=loadPOFile
 +
|description=Loads a ".PO" translation file into Cheat Engine's translation system.
 +
}}
 +
{{LuaIndexItem
 +
|page=translate
 +
|label=translate
 +
|description=Returns the translated text for a given source string. If no translation is found, returns the original string.
 +
}}
 +
{{LuaIndexItem
 +
|page=translateID
 +
|label=translateID
 +
|description=Returns the translation for a specific string ID (lookup by numerical or symbolic ID).
 +
}}
 +
}}
  
 +
=== Files ===
 +
{{LuaIndexBox
 +
|title=Files
 +
|content=
 +
{{LuaIndexItem
 +
|page=getFileVersion
 +
|label=getFileVersion
 +
|description=Returns a 64-bit file version and a table splitting the version into <code>major</code>, <code>minor</code>, <code>release</code>, and <code>build</code>.
 +
}}
 +
{{LuaIndexItem
 +
|page=getFileList
 +
|label=getFileList
 +
|description=Returns an indexed table (array) of filenames in the specified directory.
 +
}}
 +
{{LuaIndexItem
 +
|page=getDirectoryList
 +
|label=getDirectoryList
 +
|description=Returns an indexed table (array) of subdirectory names in the specified directory.
 +
}}
 +
}}
  
debug_continueFromBreakpoint(continueMethod)
+
=== Structures ===
If the debugger is currently waiting to continue you can continue with this.  
+
{{LuaIndexBox
Valid parameters are
+
|title=Structures
  co_run  just continue
+
|content=
  co_stepinto when on top of a call, follow it
+
{{LuaIndexItem
  co_stepover when on top of a call run till after the call
+
|page=registerStructureDissectOverride
 +
|label=registerStructureDissectOverride
 +
|description=Registers a callback similar to [[Lua:onAutoGuess|onAutoGuess]] that the structure dissect window calls when the user requests Cheat Engine to guess a structure layout.
 +
}}
 +
{{LuaIndexItem
 +
|page=unregisterStructureDissectOverride
 +
|label=unregisterStructureDissectOverride
 +
|description=Unregisters a previously registered structure dissect auto-guess override.
 +
}}
 +
{{LuaIndexItem
 +
|page=registerStructureNameLookup
 +
|label=registerStructureNameLookup
 +
|description=Registers a function that will be called when the structure dissect UI requests a name for a newly detected structure definition.
 +
}}
 +
{{LuaIndexItem
 +
|page=unregisterStructureNameLookup
 +
|label=unregisterStructureNameLookup
 +
|description=Unregisters a previously registered structure name lookup callback.
 +
}}
 +
}}
  
 +
=== Miscellaneous ===
 +
{{LuaIndexBox
 +
|title=Miscellaneous
 +
|content=
 +
{{LuaIndexItem
 +
|page=injectDll
 +
|label=injectDll
 +
|description=Injects a DLL into the currently opened process.
 +
}}
 +
{{LuaIndexItem
 +
|page=shellExecute
 +
|label=shellExecute
 +
|description=Executes a given command or opens a file/URL using the system shell.
 +
}}
 +
{{LuaIndexItem
 +
|page=executeCode
 +
|label=executeCode
 +
|description=Executes a stdcall function at a given address in the target process with one parameter and waits for it to return.
 +
}}
 +
{{LuaIndexItem
 +
|page=executeCodeEx
 +
|label=executeCodeEx
 +
|description=Extended version of <code>executeCode</code> (supports more parameters/options).
 +
}}
 +
{{LuaIndexItem
 +
|page=executeCodeLocal
 +
|label=executeCodeLocal
 +
|description=Executes a stdcall function at a given address in Cheat Engine's own process (local execution).
 +
}}
 +
{{LuaIndexItem
 +
|page=executeCodeLocalEx
 +
|label=executeCodeLocalEx
 +
|description=Extended version of <code>executeCodeLocal</code> with additional options.
 +
}}
 +
{{LuaIndexItem
 +
|page=onAPIPointerChange
 +
|label=onAPIPointerChange
 +
|description=Registers a callback invoked when an API pointer is changed (allows reacting to API remapping).
 +
}}
 +
{{LuaIndexItem
 +
|page=setAPIPointer
 +
|label=setAPIPointer
 +
|description=Sets the pointer/address used for a specified API function.
 +
}}
 +
{{LuaIndexItem
 +
|page=md5memory
 +
|label=md5memory
 +
|description=Computes and returns the MD5 checksum (hex string) of the bytes at the provided memory address/size.
 +
}}
 +
{{LuaIndexItem
 +
|page=md5file
 +
|label=md5file
 +
|description=Computes and returns the MD5 checksum (hex string) of a file's contents.
 +
}}
 +
{{LuaIndexItem
 +
|page=getSystemMetrics
 +
|label=getSystemMetrics
 +
|description=Retrieves the specified system metric or configuration setting. See: [https://msdn.microsoft.com/en-us/library/windows/desktop/ms724385.aspx MSDN documentation].
 +
}}
 +
{{LuaIndexItem
 +
|page=getTickCount
 +
|label=getTickCount
 +
|description=Returns the tick count in milliseconds since the system started.
 +
}}
 +
{{LuaIndexItem
 +
|page=getUserRegistryEnvironmentVariable
 +
|label=getUserRegistryEnvironmentVariable
 +
|description=Reads an environment variable stored in the current user's registry environment.
 +
}}
 +
{{LuaIndexItem
 +
|page=setUserRegistryEnvironmentVariable
 +
|label=setUserRegistryEnvironmentVariable
 +
|description=Writes an environment variable to the current user's registry environment.
 +
}}
 +
{{LuaIndexItem
 +
|page=broadcastEnvironmentUpdate
 +
|label=broadcastEnvironmentUpdate
 +
|description=Broadcasts a notification that environment variables were changed (call after setting registry variables).
 +
}}
 +
{{LuaIndexItem
 +
|page=getApplication
 +
|label=getApplication
 +
|description=Returns the application object (main application/titlebar context).
 +
}}
 +
{{LuaIndexItem
 +
|page=getInternet
 +
|label=getInternet
 +
|description=Returns an Internet client class object. The provided string specifies the client name/type.
 +
}}
 +
{{LuaIndexItem
 +
|page=signTable
 +
|label=signTable
 +
|description=Signs a .CT-File given a valid and installed Cheat Engine Signature.
 +
}}
 +
}}
  
Changing registers (Different from ce 6.0)
 
When the debugger is waiting to continue you can change the register variables. When you continue those register values will be set in the thread's context
 
  
  
The following routines describe last branch recording. These functions only work when kernelmode debugging is used and using windows XP (vista and later work less effective or not at all because the operating system interferes. Might also be intel specific. A dbvm upgrade in the future might make this work for windows vista and later)
+
<!-- BEGIN: CELUA-75 additional API coverage -->
 +
=== Extended API reference (CE 7.5) ===
 +
This section covers additional global and factory APIs exposed by <code>celua-75.lua</code>. It is grouped by the task they support rather than by their implementation order. Class instance methods remain documented with their respective classes.
  
 +
==== Core runtime, memory, and conversion helpers ====
 +
Use these for runtime detection, memory-protection changes, byte/value conversion, and sharing simple values between Lua states.
 +
{{LuaIndexBox
 +
|title=Core runtime, memory, and conversion helpers
 +
|content=
 +
{{LuaIndexItem
 +
|page=getOperatingSystem
 +
|label=getOperatingSystem
 +
|description=Returns 0 if CE is running in Windows, 1 for Mac
 +
}}
 +
{{LuaIndexItem
 +
|page=darkMode
 +
|label=darkMode
 +
|description=Returns true if CE is running in windows Dark Mode. Has no effect on mac
 +
}}
 +
{{LuaIndexItem
 +
|page=setMemoryProtection
 +
|label=setMemoryProtection
 +
|description=Sets the given protection on the address range. Note, some systems do not support X and W to be true at the same time
 +
}}
 +
{{LuaIndexItem
 +
|page=readByte
 +
|label=readByte
 +
|description=Alias for readShortInteger; reads an 8-bit integer from target-process memory.
 +
}}
 +
{{LuaIndexItem
 +
|page=readShortInteger
 +
|label=readShortInteger
 +
|description=Reads an 8-bit integer from target-process memory.
 +
}}
 +
{{LuaIndexItem
 +
|page=writeByte
 +
|label=writeByte
 +
|description=Alias for writeShortInteger; writes an 8-bit integer to target-process memory.
 +
}}
 +
{{LuaIndexItem
 +
|page=writeShortInteger
 +
|label=writeShortInteger
 +
|description=Writes an 8-bit integer to target-process memory.
 +
}}
 +
{{LuaIndexItem
 +
|page=writePointer
 +
|label=writePointer
 +
|description=Writes a pointer-sized integer to target-process memory.
 +
}}
 +
{{LuaIndexItem
 +
|page=writePointerLocal
 +
|label=writePointerLocal
 +
|description=Writes a pointer-sized integer to Cheat Engine memory.
 +
}}
 +
{{LuaIndexItem
 +
|page=signExtend
 +
|label=signExtend
 +
|description=Sign-extends a value using the specified most-significant bit.
 +
}}
 +
{{LuaIndexItem
 +
|page=extendedToByteTable
 +
|label=extendedToByteTable
 +
|description=Converts an Extended value to a byte table.
 +
}}
 +
{{LuaIndexItem
 +
|page=byteTableToExtended
 +
|label=byteTableToExtended
 +
|description=Converts a byte table to an Extended value (returned as a double).
 +
}}
 +
{{LuaIndexItem
 +
|page=getGlobalVariable
 +
|label=getGlobalVariable
 +
|description=Returns the given variable from the main lua state. Only basic types are supported. (Handy for new lua state threads)
 +
}}
 +
{{LuaIndexItem
 +
|page=setGlobalVariable
 +
|label=setGlobalVariable
 +
|description=Sets the global variable names string in the main lua state. Only basic types are supported
 +
}}
 +
{{LuaIndexItem
 +
|page=encodeFunctionEx
 +
|label=encodeFunctionEx
 +
|description=Encodes a Lua script, optionally using the specified Lua DLL.
 +
}}
 +
}}
  
debug_setLastBranchRecording(boolean)
+
==== Files, symbol loading, and native compilation ====
When set the Kernel debugger will try to record the last branch(es) taken before a breakpoint happens. Set this BEFORE you start the debugger else it will miss the first few LBR records (up to the number of cpu cores you have)
+
These APIs operate on paths, augment symbol information, or compile and assemble native and .NET code.
 +
{{LuaIndexBox
 +
|title=Files, symbol loading, and native compilation
 +
|content=
 +
{{LuaIndexItem
 +
|page=extractFileName
 +
|label=extractFileName
 +
|description=returns the filename of the path
 +
}}
 +
{{LuaIndexItem
 +
|page=extractFileExt
 +
|label=extractFileExt
 +
|description=returns the file extension of the path
 +
}}
 +
{{LuaIndexItem
 +
|page=extractFileNameWithoutExt
 +
|label=extractFileNameWithoutExt
 +
|description=Returns the filename of the path, without the extension
 +
}}
 +
{{LuaIndexItem
 +
|page=extractFilePath
 +
|label=extractFilePath
 +
|description=removes the filename from the path
 +
}}
 +
{{LuaIndexItem
 +
|page=getTempFolder
 +
|label=getTempFolder
 +
|description=Returns the path to the temp folder
 +
}}
 +
{{LuaIndexItem
 +
|page=fileExists
 +
|label=fileExists
 +
|description=Returns true if a file exists at that path
 +
}}
 +
{{LuaIndexItem
 +
|page=deleteFile
 +
|label=deleteFile
 +
|description=Returns true if a file existed at that path, and now not anymore
 +
}}
 +
{{LuaIndexItem
 +
|page=enableWindowsSymbols
 +
|label=enableWindowsSymbols
 +
|description=Will download the PDB files of Windows and load them (Takes a long time the first time)
 +
}}
 +
{{LuaIndexItem
 +
|page=enableKernelSymbols
 +
|label=enableKernelSymbols
 +
|description=Will check the option for kernelmode symbols in memory view (Gets only the exports unless enableWindowsSymbols() is used)
 +
}}
 +
{{LuaIndexItem
 +
|page=getRTTIClassName
 +
|label=getRTTIClassName
 +
|description=Returns the classname of a given structure based on RTTI information (assuming it can be found, returns nil if not or unknown)
 +
}}
 +
{{LuaIndexItem
 +
|page=reinitializeSelfSymbolhandler
 +
|label=reinitializeSelfSymbolhandler
 +
|description=Reinitializes Cheat Engine's own symbol handler.
 +
}}
 +
{{LuaIndexItem
 +
|page=waitForSections
 +
|label=waitForSections
 +
|description=Waits till the sections have been enumerated
 +
}}
 +
{{LuaIndexItem
 +
|page=waitForExports
 +
|label=waitForExports
 +
|description=Waits till all DLL Exports are loaded
 +
}}
 +
{{LuaIndexItem
 +
|page=waitForDotNet
 +
|label=waitForDotNet
 +
|description=Waits till all .NET symbols are loaded (this includes DLL Exports)
 +
}}
 +
{{LuaIndexItem
 +
|page=waitForPDB
 +
|label=waitForPDB
 +
|description=Waits till all PDB symbols are loaded (this includes DLL Exports, and .NET)
 +
}}
 +
{{LuaIndexItem
 +
|page=searchPDBWhileLoading
 +
|label=searchPDBWhileLoading
 +
|description=Will interrupt symbol enum to query the debughelp symbol handler about a specific symbol. This can take a while. Default is false
 +
}}
 +
{{LuaIndexItem
 +
|page=releaseDebugFiles
 +
|label=releaseDebugFiles
 +
|description=Stops the symbolloader from processing any debug files and releases what it had open
 +
}}
 +
{{LuaIndexItem
 +
|page=waitforsymbols
 +
|label=waitforsymbols
 +
|description=If set to true looking up a symbol will wait for the symbol to be loaded(default true)
 +
}}
 +
{{LuaIndexItem
 +
|page=assemble
 +
|label=assemble
 +
|description=Assembles one instruction and returns its bytes.
 +
}}
 +
{{LuaIndexItem
 +
|page=compile
 +
|label=compile
 +
|description=Compiles C code and returns a table with the addresses of the symbols on success, or nil with a secondary result containing the errormessage
 +
}}
 +
{{LuaIndexItem
 +
|page=compileFiles
 +
|label=compileFiles
 +
|description=Compiles an indexed list of C source files.
 +
}}
 +
{{LuaIndexItem
 +
|page=compileTCCLib
 +
|label=compileTCCLib
 +
|description=Compiles the TCC library functions some C code may need to function internally
 +
}}
 +
{{LuaIndexItem
 +
|page=addCIncludePath
 +
|label=addCIncludePath
 +
|description=Adds an extra default include path for the compile() function
 +
}}
 +
{{LuaIndexItem
 +
|page=removeCIncludePath
 +
|label=removeCIncludePath
 +
|description=Removes a specific path previously added with addCIncludePath
 +
}}
 +
{{LuaIndexItem
 +
|page=compileCS
 +
|label=compileCS
 +
|description=Compiles c# code and returns the autogenerated filename. references is a list of c# assemblies this code may reference.
 +
}}
 +
{{LuaIndexItem
 +
|page=dotNetExecuteClassMethod
 +
|label=dotNetExecuteClassMethod
 +
|description=Calls a static .NET class method from Cheat Engine.
 +
}}
 +
}}
  
 +
==== Auto Assembler authoring and callbacks ====
 +
Use callback registrations to extend Auto Assembler parsing and structure dissection; keep any returned registration ID for cleanup.
 +
{{LuaIndexBox
 +
|title=Auto Assembler authoring and callbacks
 +
|content=
 +
{{LuaIndexItem
 +
|page=registerLuaFunctionHighlight
 +
|label=registerLuaFunctionHighlight
 +
|description=Makes the lua highlighter show the functionname as a functionkeyword
 +
}}
 +
{{LuaIndexItem
 +
|page=unregisterLuaFunctionHighlight
 +
|label=unregisterLuaFunctionHighlight
 +
|description=Removes the given name from showing up as a functionkeyword
 +
}}
 +
{{LuaIndexItem
 +
|page=registerGlobalStructureListUpdateNotification
 +
|label=registerGlobalStructureListUpdateNotification
 +
|description=Registers a callback for global-structure-list updates.
 +
}}
 +
{{LuaIndexItem
 +
|page=unregisterGlobalStructureListUpdateNotification
 +
|label=unregisterGlobalStructureListUpdateNotification
 +
|description=Unregisters a global-structure-list update callback.
 +
}}
 +
{{LuaIndexItem
 +
|page=registerStructureAndElementListCallback
 +
|label=registerStructureAndElementListCallback
 +
|description=Registers a function to be called when a structure needs to be dissected
 +
}}
 +
{{LuaIndexItem
 +
|page=unregisterStructureAndElementListCallback
 +
|label=unregisterStructureAndElementListCallback
 +
|description=Unregisters the structure and element list callback.
 +
}}
 +
{{LuaIndexItem
 +
|page=getNextAllocNumber
 +
|label=getNextAllocNumber
 +
|description=Returns the next unused newmem allocation number in an Auto Assembler script.
 +
}}
 +
{{LuaIndexItem
 +
|page=addSnapshotAsComment
 +
|label=addSnapshotAsComment
 +
|description=Adds a snapshot of original code as a comment to an Auto Assembler script.
 +
}}
 +
{{LuaIndexItem
 +
|page=getUniqueAOB
 +
|label=getUniqueAOB
 +
|description=Finds a unique AOB pattern for an address and returns its offset.
 +
}}
 +
}}
  
debug_getMaxLastBranchRecord()  
+
==== Process control, code execution, and prompts ====
Returns the maximum branch record your cpu can store (-1 if none)
+
This group covers process handles, code invocation, clipboard access, GC control, and small user-facing dialogs.
 +
{{LuaIndexBox
 +
|title=Process control, code execution, and prompts
 +
|content=
 +
{{LuaIndexItem
 +
|page=showSelectionList
 +
|label=showSelectionList
 +
|description=Shows a selection list and returns the selected index and text.
 +
}}
 +
{{LuaIndexItem
 +
|page=duplicateHandle
 +
|label=duplicateHandle
 +
|description=Duplicates the provided CE based handle into the target process (You still need tell the target about this handle, like an injected dll data block)
 +
}}
 +
{{LuaIndexItem
 +
|page=onTableLoad
 +
|label=onTableLoad
 +
|description=If defined this function will be called twice when a table gets loaded. Once before the loading, and once after.
 +
}}
 +
{{LuaIndexItem
 +
|page=getOpenedProcessHandle
 +
|label=getOpenedProcessHandle
 +
|description=Returns the handle of the currently opened process
 +
}}
 +
{{LuaIndexItem
 +
|page=getOpenedFileSize
 +
|label=getOpenedFileSize
 +
|description=Returns the size of the currently opened target executable.
 +
}}
 +
{{LuaIndexItem
 +
|page=getPointerSize
 +
|label=getPointerSize
 +
|description=Gets the current pointersize
 +
}}
 +
{{LuaIndexItem
 +
|page=cpuid
 +
|label=cpuid
 +
|description=Returns CPUID register values for the supplied EAX and ECX inputs.
 +
}}
 +
{{LuaIndexItem
 +
|page=gc_setPassive
 +
|label=gc_setPassive
 +
|description=Enables or disables the passive Lua garbage collector.
 +
}}
 +
{{LuaIndexItem
 +
|page=gc_setActive
 +
|label=gc_setActive
 +
|description=Configures the active Lua garbage collector.
 +
}}
 +
{{LuaIndexItem
 +
|page=invertColor
 +
|label=invertColor
 +
|description=Returns the inverted color
 +
}}
 +
{{LuaIndexItem
 +
|page=runCommand
 +
|label=runCommand
 +
|description=Executes the given command and returns the output of the command as a string and the exitcode as an integer (Should not open a console window) If pathtoexecutein is not provided the path...
 +
}}
 +
{{LuaIndexItem
 +
|page=readFromClipboard
 +
|label=readFromClipboard
 +
|description=Reads the text from the clipboard
 +
}}
 +
{{LuaIndexItem
 +
|page=injectLibrary
 +
|label=injectLibrary
 +
|description=Alias for injectDLL; injects a DLL or dylib into the target process.
 +
}}
 +
{{LuaIndexItem
 +
|page=injectDotNetDLL
 +
|label=injectDotNetDLL
 +
|description=Injects a .NET assembly and invokes its specified method.
 +
}}
 +
{{LuaIndexItem
 +
|page=executeMethod
 +
|label=executeMethod
 +
|description=Executes a method.
 +
}}
 +
}}
  
 +
==== Target inspection, allocation, and task progress ====
 +
These helpers inspect the target architecture, allocate memory in Cheat Engine, disassemble bytes, or update Windows taskbar progress.
 +
{{LuaIndexBox
 +
|title=Target inspection, allocation, and task progress
 +
|content=
 +
{{LuaIndexItem
 +
|page=allocateSharedMemoryLocal
 +
|label=allocateSharedMemoryLocal
 +
|description=Allocates named shared memory in the Cheat Engine process.
 +
}}
 +
{{LuaIndexItem
 +
|page=targetIsX86
 +
|label=targetIsX86
 +
|description=Returns true if the target process is x86 based
 +
}}
 +
{{LuaIndexItem
 +
|page=targetIsArm
 +
|label=targetIsArm
 +
|description=Returns true if the target process is arm based
 +
}}
 +
{{LuaIndexItem
 +
|page=targetIsAndroid
 +
|label=targetIsAndroid
 +
|description=Returns true if the target process is running on the Android OS
 +
}}
 +
{{LuaIndexItem
 +
|page=getAutorunPath
 +
|label=getAutorunPath
 +
|description=Returns the autorun path
 +
}}
 +
{{LuaIndexItem
 +
|page=disassembleBytes
 +
|label=disassembleBytes
 +
|description=Disassembles the given bytes and returns the result.
 +
}}
 +
{{LuaIndexItem
 +
|page=printf
 +
|label=printf
 +
|description=Same as print(string.format(...))
 +
}}
 +
{{LuaIndexItem
 +
|page=setProgressState
 +
|label=setProgressState
 +
|description=Sets the state of the cheatengine task in the taskbar (windows only) values: tbpsNone, tbpsIndeterminate, tbpsNormal, tbpsError, tbpsPaused
 +
}}
 +
{{LuaIndexItem
 +
|page=setProgressValue
 +
|label=setProgressValue
 +
|description=Sets the state of the cheatengine task progress status
 +
}}
 +
}}
  
debug_getLastBranchRecord(index)
+
==== Registered symbols ====
Returns the value of the Last Branch Record at the given index (when handling a breakpoint)
+
Use these only for symbols registered through Lua or Auto Assembler; they do not enumerate every symbol known to the symbol handler.
 +
{{LuaIndexBox
 +
|title=Registered symbols
 +
|content=
 +
{{LuaIndexItem
 +
|page=enumRegisteredSymbols
 +
|label=enumRegisteredSymbols
 +
|description=Returns a table with elements containing {symbolname, address, OPTIONAL {allocsize, processid, donotsave}}
 +
{{LuaIndexItem
 +
|page=deleteAllRegisteredSymbols
 +
|label=deleteAllRegisteredSymbols
 +
|description=Deletes all symbols registered with registerSymbols, both in AA and Lua scripts (Does not remove registered symbolLists)}}
 +
}}
  
 +
==== Debugging extensions ====
 +
These functions add debugger state checks and per-thread breakpoint control beyond the main debugger section.
 +
{{LuaIndexBox
 +
|title=Debugging extensions
 +
|content=
 +
{{LuaIndexItem
 +
|page=debug_isStepping
 +
|label=debug_isStepping
 +
|description=Returns true if the debugger was single stepping an instruction earlier
 +
}}
 +
{{LuaIndexItem
 +
|page=debug_breakThread
 +
|label=debug_breakThread
 +
|description=Breaks the thread with the specific threadID (Note: The thread may not break instantly and may have to be awakened first)
 +
}}
 +
{{LuaIndexItem
 +
|page=debug_setBreakpointForThread
 +
|label=debug_setBreakpointForThread
 +
|description=sets a breakpoint of a specific size at the given address for the specified thread. if trigger is bptExecute then size is ignored.
 +
}}
 +
}}
  
 +
==== Forms, controls, graphics, dialogs, and streams ====
 +
All <code>create...</code> entries here return a CE class object. Assign an owner where the function accepts one so the object's lifetime is managed correctly.
 +
{{LuaIndexBox
 +
|title=Forms, controls, graphics, dialogs, and streams
 +
|content=
 +
{{LuaIndexItem
 +
|page=createRegion
 +
|label=createRegion
 +
|description=Created an empty region
 +
}}
 +
{{LuaIndexItem
 +
|page=createMenuItem
 +
|label=createMenuItem
 +
|description=Creates a menu item that gets added to the owner menu
 +
}}
 +
{{LuaIndexItem
 +
|page=createMainMenu
 +
|label=createMainMenu
 +
|description=Creates a MainMenu object.
 +
}}
 +
{{LuaIndexItem
 +
|page=createPopupMenu
 +
|label=createPopupMenu
 +
|description=Creates a PopupMenu object.
 +
}}
 +
{{LuaIndexItem
 +
|page=createImageList
 +
|label=createImageList
 +
|description=creates an imagelist object
 +
}}
 +
{{LuaIndexItem
 +
|page=createStringlist
 +
|label=createStringlist
 +
|description=Creates a stringlist class object (for whatever reason, lua strings are probably easier to use)
 +
}}
 +
{{LuaIndexItem
 +
|page=createForm
 +
|label=createForm
 +
|description=creates a CEForm class object(window) and returns the pointer for it. Visible is default true but can be changed
 +
}}
 +
{{LuaIndexItem
 +
|page=createFormFromFile
 +
|label=createFormFromFile
 +
|description=Returns the generated CEform
 +
}}
 +
{{LuaIndexItem
 +
|page=createFormFromStream
 +
|label=createFormFromStream
 +
|description=Returns the generated CEform
 +
}}
 +
{{LuaIndexItem
 +
|page=createLuaEngine
 +
|label=createLuaEngine
 +
|description=Creates a new lua engine form object. If there is no main luaengine window, this will become it.
 +
}}
 +
{{LuaIndexItem
 +
|page=createAutoAssemblerForm
 +
|label=createAutoAssemblerForm
 +
|description=TFrmAutoInject - Spawns an autoassembler window with the optionally provided script
 +
}}
 +
{{LuaIndexItem
 +
|page=createPaintBox
 +
|label=createPaintBox
 +
|description=Creates a Paintbox class object
 +
}}
 +
{{LuaIndexItem
 +
|page=createLabel
 +
|label=createLabel
 +
|description=Creates a Label class object which belongs to the given owner. Owner can be any object inherited from WinControl
 +
}}
 +
{{LuaIndexItem
 +
|page=createSplitter
 +
|label=createSplitter
 +
|description=Creates a Splitter class object which belongs to the given owner. Owner can be any object inherited from WinControl
 +
}}
 +
{{LuaIndexItem
 +
|page=createPanel
 +
|label=createPanel
 +
|description=Creates a Panel class object which belongs to the given owner. Owner can be any object inherited from WinControl
 +
}}
 +
{{LuaIndexItem
 +
|page=createImage
 +
|label=createImage
 +
|description=Creates an Image class object which belongs to the given owner. Owner can be any object inherited from WinControl
 +
}}
 +
{{LuaIndexItem
 +
|page=createEdit
 +
|label=createEdit
 +
|description=Creates an Edit class object which belongs to the given owner. Owner can be any object inherited from WinControl
 +
}}
 +
{{LuaIndexItem
 +
|page=createMemo
 +
|label=createMemo
 +
|description=Creates a Memo class object which belongs to the given owner. Owner can be any object inherited from WinControl
 +
}}
 +
{{LuaIndexItem
 +
|page=createSynEdit
 +
|label=createSynEdit
 +
|description=Creates a synedit object. mode: 0=Lua highlighting, 1=Auto Assembler highlighting
 +
}}
 +
{{LuaIndexItem
 +
|page=createButton
 +
|label=createButton
 +
|description=Creates a Button class object which belongs to the given owner. Owner can be any object inherited from WinControl
 +
}}
 +
{{LuaIndexItem
 +
|page=createCheckBox
 +
|label=createCheckBox
 +
|description=Creates a CheckBox class object which belongs to the given owner. Owner can be any object inherited from WinControl
 +
}}
 +
{{LuaIndexItem
 +
|page=createToggleBox
 +
|label=createToggleBox
 +
|description=Creates a ToggleBox class object which belongs to the given owner. Owner can be any object inherited from WinControl
 +
}}
 +
{{LuaIndexItem
 +
|page=createGroupBox
 +
|label=createGroupBox
 +
|description=Creates a GroupBox class object which belongs to the given owner. Owner can be any object inherited from WinControl
 +
}}
 +
{{LuaIndexItem
 +
|page=createRadioGroup
 +
|label=createRadioGroup
 +
|description=Creates a RadioGroup class object which belongs to the given owner. Owner can be any object inherited from WinControl
 +
}}
 +
{{LuaIndexItem
 +
|page=createListBox
 +
|label=createListBox
 +
|description=Creates a ListBox class object which belongs to the given owner. Owner can be any object inherited from WinControl
 +
}}
 +
{{LuaIndexItem
 +
|page=createCalendar
 +
|label=createCalendar
 +
|description=Creates a Calendar class object which belongs to the given owner. Owner can be any object inherited from WinControl. Valid date is between "September 14, 1752" and "December 31, 9999"
 +
}}
 +
{{LuaIndexItem
 +
|page=createComboBox
 +
|label=createComboBox
 +
|description=Creates a ComboBox class object which belongs to the given owner. Owner can be any object inherited from WinControl
 +
}}
 +
{{LuaIndexItem
 +
|page=createProgressBar
 +
|label=createProgressBar
 +
|description=Creates a ProgressBar class object which belongs to the given owner. Owner can be any object inherited from WinControl
 +
}}
 +
{{LuaIndexItem
 +
|page=createTrackBar
 +
|label=createTrackBar
 +
|description=Creates a TrackBar class object which belongs to the given owner. Owner can be any object inherited from WinControl
 +
}}
 +
{{LuaIndexItem
 +
|page=createListView
 +
|label=createListView
 +
|description=Creates a ListView class object which belongs to the given owner. Owner can be any object inherited from WinControl
 +
}}
 +
{{LuaIndexItem
 +
|page=createTreeView
 +
|label=createTreeView
 +
|description=Creates a TreeView object.
 +
}}
 +
{{LuaIndexItem
 +
|page=createTimer
 +
|label=createTimer
 +
|description=Creates a Timer object.
 +
}}
 +
{{LuaIndexItem
 +
|page=createFont
 +
|label=createFont
 +
|description=Returns a font object (default initialized based on the main ce window)
 +
}}
 +
{{LuaIndexItem
 +
|page=createBitmap
 +
|label=createBitmap
 +
|description=Returns a Bitmap object
 +
}}
 +
{{LuaIndexItem
 +
|page=createPNG
 +
|label=createPNG
 +
|description=Returns a PortableNetworkGraphic object
 +
}}
 +
{{LuaIndexItem
 +
|page=createJpeg
 +
|label=createJpeg
 +
|description=Returns a Jpeg object
 +
}}
 +
{{LuaIndexItem
 +
|page=createIcon
 +
|label=createIcon
 +
|description=Returns an Icon object
 +
}}
 +
{{LuaIndexItem
 +
|page=createPicture
 +
|label=createPicture
 +
|description=Returns a empty picture object
 +
}}
 +
{{LuaIndexItem
 +
|page=createHotkey
 +
|label=createHotkey
 +
|description=returns an initialized GenericHotkey class object. Maximum of 5 keys
 +
}}
 +
{{LuaIndexItem
 +
|page=createColorDialog
 +
|label=createColorDialog
 +
|description=Creates a new colordialog
 +
}}
 +
{{LuaIndexItem
 +
|page=createColorBox
 +
|label=createColorBox
 +
|description=Creates a new colorbox
 +
}}
 +
{{LuaIndexItem
 +
|page=createFindDialog
 +
|label=createFindDialog
 +
|description=Creates a find dialog object.
 +
}}
 +
{{LuaIndexItem
 +
|page=createOpenDialog
 +
|label=createOpenDialog
 +
|description=Creates an opendialog object
 +
}}
 +
{{LuaIndexItem
 +
|page=createSaveDialog
 +
|label=createSaveDialog
 +
|description=Creates a save dialog object.
 +
}}
 +
{{LuaIndexItem
 +
|page=createSelectDirectoryDialog
 +
|label=createSelectDirectoryDialog
 +
|description=Creates a directory-selection dialog object.
 +
}}
 +
{{LuaIndexItem
 +
|page=createFileStream
 +
|label=createFileStream
 +
|description=Creates a file-backed stream with the requested mode.
 +
}}
 +
{{LuaIndexItem
 +
|page=createStringStream
 +
|label=createStringStream
 +
|description=Creates a stream backed by a string buffer.
 +
}}
 +
{{LuaIndexItem
 +
|page=createMemScan
 +
|label=createMemScan
 +
|description=Returns a new MemScan class object
 +
}}
 +
{{LuaIndexItem
 +
|page=createFoundList
 +
|label=createFoundList
 +
|description=Creates a FoundList for the provided MemScan object.
 +
}}
 +
{{LuaIndexItem
 +
|page=createMemoryView
 +
|label=createMemoryView
 +
|description=Creates a new memoryview window. This window will not receive debug events. Use getMemoryViewForm() function to get the main memoryview window
 +
}}
 +
}}
  
 +
==== Threads, synchronization, and structures ====
 +
Use synchronization objects when worker threads share state. Structure helpers create or retrieve layout definitions used by the structure dissector.
 +
{{LuaIndexBox
 +
|title=Threads, synchronization, and structures
 +
|content=
 +
{{LuaIndexItem
 +
|page=createThread
 +
|label=createThread
 +
|description=Creates and starts a native thread for the supplied Lua function.
 +
}}
 +
{{LuaIndexItem
 +
|page=createThreadSuspended
 +
|label=createThreadSuspended
 +
|description=Creates a native thread in the suspended state.
 +
}}
 +
{{LuaIndexItem
 +
|page=createThreadNewState
 +
|label=createThreadNewState
 +
|description=Creates a new thread in a new lua state. This is more efficient as no locking inside lua takes place, but has no access to userdefined lua functions and only limited base CE functions.
 +
}}
 +
{{LuaIndexItem
 +
|page=createCriticalSection
 +
|label=createCriticalSection
 +
|description=Returns a critical section object
 +
}}
 +
{{LuaIndexItem
 +
|page=createEvent
 +
|label=createEvent
 +
|description=Returns an event object
 +
}}
 +
{{LuaIndexItem
 +
|page=createSemaphore
 +
|label=createSemaphore
 +
|description=Returns an semaphore object
 +
}}
 +
{{LuaIndexItem
 +
|page=createMultiReadExclusiveWriteSynchronizer
 +
|label=createMultiReadExclusiveWriteSynchronizer
 +
|description=Returns a createMultiReadExclusiveWriteSynchronizer
 +
}}
 +
{{LuaIndexItem
 +
|page=createStructureForm
 +
|label=createStructureForm
 +
|description=Opens a structure dissect form for an address.
 +
}}
 +
{{LuaIndexItem
 +
|page=enumStructureForms
 +
|label=enumStructureForms
 +
|description=returns a table of StructureFrm objects (can be useful for finding a structure window with the wanted structure)
 +
}}
 +
{{LuaIndexItem
 +
|page=getStructureCount
 +
|label=getStructureCount
 +
|description=Returns the number of Global structures. (Global structures are the visible structures)
 +
}}
 +
{{LuaIndexItem
 +
|page=getStructure
 +
|label=getStructure
 +
|description=Returns the Structure object at the given index
 +
}}
 +
{{LuaIndexItem
 +
|page=createStructure
 +
|label=createStructure
 +
|description=Returns an empty structure object (Not yet added to the Global list. Call structure.addToGlobalStructureList manually)
 +
}}
 +
{{LuaIndexItem
 +
|page=createStructureFromName
 +
|label=createStructureFromName
 +
|description=If PDB files are loaded this will create a structure with that name if it can be found
 +
}}
 +
}}
  
 +
==== Low-level memory: DBK and DBVM ====
 +
'''Advanced / platform-specific.''' These APIs require the DBK driver and/or DBVM and can affect the whole system, not only the opened process.
 +
{{LuaIndexBox
 +
|title=Low-level memory: DBK and DBVM
 +
|content=
 +
{{LuaIndexItem
 +
|page=dbk_usePhysicalMemoryAccess
 +
|label=dbk_usePhysicalMemoryAccess
 +
|description=Changes all memory access to physical memory
 +
}}
 +
{{LuaIndexItem
 +
|page=dbk_setSaferPhysicalMemoryScanning
 +
|label=dbk_setSaferPhysicalMemoryScanning
 +
|description=When set to true CE's memory scanner will skip hardware device owned memory. Default state is true
 +
}}
 +
{{LuaIndexItem
 +
|page=dbk_readPhysicalMemory
 +
|label=dbk_readPhysicalMemory
 +
|description=Reads physical memory through the DBK driver and returns a byte table.
 +
}}
 +
{{LuaIndexItem
 +
|page=dbk_writePhysicalMemory
 +
|label=dbk_writePhysicalMemory
 +
|description=Writes physical memory through the DBK driver.
 +
}}
 +
{{LuaIndexItem
 +
|page=dbvm_setKeys
 +
|label=dbvm_setKeys
 +
|description=Sets the keys to operate DBVM. Key1 and Key3 are pointersize, key2 is 32-bit. Note that if key1 or key3 are 64-bit wide, 32-bit CE can not use DBVM.
 +
}}
 +
{{LuaIndexItem
 +
|page=dbvm_getMemory
 +
|label=dbvm_getMemory
 +
|description=Returns the total memory free for DBVM, and the total number of full pages as secondary result
 +
}}
 +
{{LuaIndexItem
 +
|page=dbvm_watch_executes
 +
|label=dbvm_watch_executes
 +
|description=Creates a DBVM watch that records instruction execution.
 +
}}
 +
{{LuaIndexItem
 +
|page=dbvm_traceonbp
 +
|label=dbvm_traceonbp
 +
|description=Sets a int3 breakpoint at the given address after cloaking that page and when hit does a trace.
 +
}}
 +
{{LuaIndexItem
 +
|page=dbvm_traceonbp_getstatus
 +
|label=dbvm_traceonbp_getstatus
 +
|description=Returns DBVM trace status, current entry count, and maximum count.
 +
}}
 +
{{LuaIndexItem
 +
|page=dbvm_traceonbp_stoptrace
 +
|label=dbvm_traceonbp_stoptrace
 +
|description=Requests the active DBVM trace to stop.
 +
}}
 +
{{LuaIndexItem
 +
|page=dbvm_traceonbp_remove
 +
|label=dbvm_traceonbp_remove
 +
|description=Disables the current trace and removes all results
 +
}}
 +
{{LuaIndexItem
 +
|page=dbvm_traceonbp_retrievelog
 +
|label=dbvm_traceonbp_retrievelog
 +
|description=Returns an array of traceentries. (Context of the system at the time of the event, like registers)
 +
}}
 +
{{LuaIndexItem
 +
|page=dbvm_bp_getBrokenThreadListSize
 +
|label=dbvm_bp_getBrokenThreadListSize
 +
|description=Returns the number of breakpoint slots currently available
 +
}}
 +
{{LuaIndexItem
 +
|page=dbvm_bp_getBrokenThreadEventShort
 +
|label=dbvm_bp_getBrokenThreadEventShort
 +
|description=Returns summary information for a DBVM breakpoint event.
 +
}}
 +
{{LuaIndexItem
 +
|page=dbvm_bp_getBrokenThreadEventFull
 +
|label=dbvm_bp_getBrokenThreadEventFull
 +
|description=Returns full register, FPU, and stack information for a DBVM breakpoint event.
 +
}}
 +
{{LuaIndexItem
 +
|page=dbvm_bp_setBrokenThreadEventFull
 +
|label=dbvm_bp_setBrokenThreadEventFull
 +
|description=Sets the state of the frozen thread
 +
}}
 +
{{LuaIndexItem
 +
|page=dbvm_bp_resumeBrokenThread
 +
|label=dbvm_bp_resumeBrokenThread
 +
|description=Resumes the specific thread. continueMethod can be 0=run, 1=step into
 +
}}
 +
{{LuaIndexItem
 +
|page=dbvm_bp_getProcessAndThreadIDFromEvent
 +
|label=dbvm_bp_getProcessAndThreadIDFromEvent
 +
|description=Returns the process and thread IDs for a DBVM breakpoint event.
 +
}}
 +
{{LuaIndexItem
 +
|page=getPhysicalAddressCR3
 +
|label=getPhysicalAddressCR3
 +
|description=Looks up the physical address for the given virtual address in the given pagetable base. Returns nil if not paged
 +
}}
 +
{{LuaIndexItem
 +
|page=readProcessMemoryCR3
 +
|label=readProcessMemoryCR3
 +
|description=Reads the virtual memory of the given process's CR3 value. Returns a bytetable on success, nil if fail to read (paged out)
 +
}}
 +
{{LuaIndexItem
 +
|page=writeProcessMemoryCR3
 +
|label=writeProcessMemoryCR3
 +
|description=Writes virtual memory using the supplied process CR3 value.
 +
}}
 +
}}
  
 +
==== Direct3D, disassembly, and pipes ====
 +
Use this group for overlays, custom disassembly output, named-pipe communication, and related analysis tools.
 +
{{LuaIndexBox
 +
|title=Direct3D, disassembly, and pipes
 +
|content=
 +
{{LuaIndexItem
 +
|page=createD3DHook
 +
|label=createD3DHook
 +
|description=Creates a Direct3D hook object.
 +
}}
 +
{{LuaIndexItem
 +
|page=createDisassembler
 +
|label=createDisassembler
 +
|description=Creates a disassembler object that can be used to disassemble an instruction and at the same time get more data
 +
}}
 +
{{LuaIndexItem
 +
|page=getDefaultDisassembler
 +
|label=getDefaultDisassembler
 +
|description=Returns the default disassembler object used by a lot of ce's disassembler routines (Only use this from the main thread)
 +
}}
 +
{{LuaIndexItem
 +
|page=getVisibleDisassembler
 +
|label=getVisibleDisassembler
 +
|description=Returns the legacy shared visible-disassembler override object.
 +
}}
 +
{{LuaIndexItem
 +
|page=registerGlobalDisassembleOverride
 +
|label=registerGlobalDisassembleOverride
 +
|description=Same as Disassembler.OnDisassembleOverride, but does it for all disassemblers, including newly created ones. Tip: Check the sender to see if you should use syntax highlighting codes or not
 +
}}
 +
{{LuaIndexItem
 +
|page=unregisterGlobalDisassembleOverride
 +
|label=unregisterGlobalDisassembleOverride
 +
|description=Unregisters a global disassembler override callback.
 +
}}
 +
{{LuaIndexItem
 +
|page=getDissectCode
 +
|label=getDissectCode
 +
|description=Creates or returns the current code DissectCode object
 +
}}
 +
{{LuaIndexItem
 +
|page=createRipRelativeScanner
 +
|label=createRipRelativeScanner
 +
|description=Creates a RipRelativeScanner object.
 +
}}
 +
{{LuaIndexItem
 +
|page=connectToPipe
 +
|label=connectToPipe
 +
|description=Returns a LuaPipeClient connected to the given pipename. Nil if the connection fails. Timeout is number of milliseconds before it disconnects on read/write operations. 0 or nil means never
 +
}}
 +
{{LuaIndexItem
 +
|page=createPipe
 +
|label=createPipe
 +
|description=Creates a LuaPipeServer which can be connected to by a pipe client. InputSize and Outputsize define buffers how much data can be in the specific buffer before the writer halts.
 +
}}
 +
{{LuaIndexItem
 +
|page=openLuaServer
 +
|label=openLuaServer
 +
|description=Starts a Lua server with the supplied name.
 +
}}
 +
{{LuaIndexItem
 +
|page=getUltimap2
 +
|label=getUltimap2
 +
|description=Returns the Ultimap2 form, or nil when it is not open.
 +
}}
 +
{{LuaIndexItem
 +
|page=getCodeFilter
 +
|label=getCodeFilter
 +
|description=Returns the Code Filter form.
 +
}}
 +
}}
  
 +
==== SQL and data access ====
 +
These factory functions create database connections, transactions, and queries. Configure the appropriate connection before executing a query.
 +
{{LuaIndexBox
 +
|title=SQL and data access
 +
|content=
 +
{{LuaIndexItem
 +
|page=createSQLite3Connection
 +
|label=createSQLite3Connection
 +
|description=creates an SQLite3Connection object
 +
}}
 +
{{LuaIndexItem
 +
|page=setSQLiteLibraryName
 +
|label=setSQLiteLibraryName
 +
|description=Lets you set the path to the sqlite3.dll in case it's not .\win*\sqlite3.dll
 +
}}
 +
{{LuaIndexItem
 +
|page=createODBCConnection
 +
|label=createODBCConnection
 +
|description=creates an ODBCConnection object
 +
}}
 +
{{LuaIndexItem
 +
|page=createSQLTransaction
 +
|label=createSQLTransaction
 +
|description=Creates an SQLTransaction object
 +
}}
 +
{{LuaIndexItem
 +
|page=createSQLQuery
 +
|label=createSQLQuery
 +
|description=Creates an SQL query object.
 +
}}
 +
}}
  
 +
==== Modules, .NET, and diagrams ====
 +
The .NET functions query data collected from the target; they require an active .NET data collector and may return empty data when the runtime is unavailable.
 +
{{LuaIndexBox
 +
|title=Modules, .NET, and diagrams
 +
|content=
 +
{{LuaIndexItem
 +
|page=getHotkeyHandlerThread
 +
|label=getHotkeyHandlerThread
 +
|description=Returns the hotkey handler thread used internally by CE
 +
}}
 +
{{LuaIndexItem
 +
|page=createRemoteThread
 +
|label=createRemoteThread
 +
|description=Creates a remote thread in the target process.
 +
}}
 +
{{LuaIndexItem
 +
|page=loadModule
 +
|label=loadModule
 +
|description=Loads a DLL/module into the target process.
 +
}}
 +
{{LuaIndexItem
 +
|page=getDotNetDataCollector
 +
|label=getDotNetDataCollector
 +
|description=Returns the current dotnetdatacollector object
 +
}}
 +
{{LuaIndexItem
 +
|page=enumDomains
 +
|label=enumDomains
 +
|description=Returns all .NET application domains collected from the target.
 +
}}
 +
{{LuaIndexItem
 +
|page=enumModuleList
 +
|label=enumModuleList
 +
|description=Returns .NET modules for the specified application domain.
 +
}}
 +
{{LuaIndexItem
 +
|page=enumTypeDefs
 +
|label=enumTypeDefs
 +
|description=Returns type definitions for the specified .NET module.
 +
}}
 +
{{LuaIndexItem
 +
|page=getTypeDefMethods
 +
|label=getTypeDefMethods
 +
|description=Returns methods for the specified .NET type definition.
 +
}}
 +
{{LuaIndexItem
 +
|page=getTypeDefParent
 +
|label=getTypeDefParent
 +
|description=Returns the parent module and type definition for a .NET type.
 +
}}
 +
{{LuaIndexItem
 +
|page=getTypeDefData
 +
|label=getTypeDefData
 +
|description=Returns field and layout data for the specified .NET type.
 +
}}
 +
{{LuaIndexItem
 +
|page=getMethodParameters
 +
|label=getMethodParameters
 +
|description=Returns parameters for the specified .NET method.
 +
}}
 +
{{LuaIndexItem
 +
|page=getAddressData
 +
|label=getAddressData
 +
|description=Returns .NET object and field data for the specified address.
 +
}}
 +
{{LuaIndexItem
 +
|page=enumAllObjects
 +
|label=enumAllObjects
 +
|description=Enumerates all collected .NET objects; this may take a long time.
 +
}}
 +
{{LuaIndexItem
 +
|page=enumAllObjectsOfType
 +
|label=enumAllObjectsOfType
 +
|description=Returns addresses of collected .NET objects with the specified type.
 +
}}
 +
{{LuaIndexItem
 +
|page=createDiagram
 +
|label=createDiagram
 +
|description=Creates a diagram control object.
 +
}}
 +
}}
  
 +
==== Remote execution, XML, and virtual trees ====
 +
These APIs create reusable helpers for remote calls, XML documents, custom CE controls, and virtual trees.
 +
{{LuaIndexBox
 +
|title=Remote execution, XML, and virtual trees
 +
|content=
 +
{{LuaIndexItem
 +
|page=createExecuteMethodStub
 +
|label=createExecuteMethodStub
 +
|description=Creates an ExecuteCodeExStub object which the executor can execute
 +
}}
 +
{{LuaIndexItem
 +
|page=createExecuteCodeExStub
 +
|label=createExecuteCodeExStub
 +
|description=Creates an ExecuteCodeExStub object which the executor can execute
 +
}}
 +
{{LuaIndexItem
 +
|page=createRemoteExecutor
 +
|label=createRemoteExecutor
 +
|description=creates a new remote executor
 +
}}
 +
{{LuaIndexItem
 +
|page=createCECustomButton
 +
|label=createCECustomButton
 +
|description=Creates a Cheat Engine custom button control.
 +
}}
 +
{{LuaIndexItem
 +
|page=createXMLDocument
 +
|label=createXMLDocument
 +
|description=Creates an empty XML document
 +
}}
 +
{{LuaIndexItem
 +
|page=createXMLDocumentFromFile
 +
|label=createXMLDocumentFromFile
 +
|description=reads the given filename and return an XMLDocument with the parsed contents of the file
 +
}}
 +
{{LuaIndexItem
 +
|page=createXMLDocumentFromStream
 +
|label=createXMLDocumentFromStream
 +
|description=reads the given stream and returns an XMLDocument with the parsed contents of the stream
 +
}}
 +
{{LuaIndexItem
 +
|page=createVirtualStringTree
 +
|label=createVirtualStringTree
 +
|description=Creates a VirtualStringTree object.
 +
}}
 +
}}
  
 +
==== CEServer and Lua string extensions ====
 +
CEServer functions apply only after connecting to a server. The string functions are called as methods (for example <code>text:startsWith('CE')</code>).
 +
{{LuaIndexBox
 +
|title=CEServer and Lua string extensions
 +
|content=
 +
{{LuaIndexItem
 +
|page=isConnectedToCEServer
 +
|label=isConnectedToCEServer
 +
|description=Returns whether Cheat Engine is connected to CEServer.
 +
}}
 +
{{LuaIndexItem
 +
|page=getCEServerPath
 +
|label=getCEServerPath
 +
|description=Returns the CEServer path on the target.
 +
}}
 +
{{LuaIndexItem
 +
|page=split
 +
|label=split
 +
|description=Splits a string at the specified separator.
 +
}}
 +
{{LuaIndexItem
 +
|page=endsWith
 +
|label=endsWith
 +
|description=Returns whether a string ends with the specified text.
 +
}}
 +
{{LuaIndexItem
 +
|page=startsWith
 +
|label=startsWith
 +
|description=Returns whether a string starts with the specified text.
 +
}}
 +
}}
 +
<!-- END: CELUA-75 additional API coverage -->
  
 +
== Classes ==
 +
A compact list of notable classes implemented by Cheat Engine.
 +
{{LuaIndexBox
 +
|title=Classes
 +
|content=
 +
{{LuaIndexItem
 +
|page=Class:Addresslist
 +
|label=Addresslist
 +
|description=Container for memory records in a cheat table.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:Bitmap
 +
|label=Bitmap
 +
|description=Bitmap graphic object for drawing images.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:Brush
 +
|label=Brush
 +
|description=Brush used by a Canvas to fill areas.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:Button
 +
|label=Button
 +
|description=Visual button component.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:ButtonControl
 +
|label=ButtonControl
 +
|description=Base class common to button-like controls.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:Canvas
 +
|label=Canvas
 +
|description=Drawing surface used in paint events for lines, text, and images.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:Calendar
 +
|label=Calendar
 +
|description=Calendar/date-picker UI control.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:CEForm
 +
|label=CEForm
 +
|description=Cheat Engine main/form window class.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:CheatComponent
 +
|label=CheatComponent
 +
|description=Component used in Cheat Engine 5.x trainers.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:CheckBox
 +
|label=CheckBox
 +
|description=Checkbox UI control supporting checked/unchecked/indeterminate states.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:Component
 +
|label=Component
 +
|description=Base class for owner-managed components.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:Control
 +
|label=Control
 +
|description=Base class for visible UI controls.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:Collection
 +
|label=Collection
 +
|description=Abstract collection class (used by ListColumns and similar).
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:CollectionItem
 +
|label=CollectionItem
 +
|description=Item managed by a Collection.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:ComboBox
 +
|label=ComboBox
 +
|description=Edit field with an attached dropdown ListBox.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:CriticalSection
 +
|label=CriticalSection
 +
|description=Synchronization primitive for thread-safe access.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:CustomControl
 +
|label=CustomControl
 +
|description=Base class for windowed controls that handle their own painting.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:CustomType
 +
|label=CustomType
 +
|description=Custom data-type converter for interpreting raw memory.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:D3DHOOK
 +
|label=D3DHOOK
 +
|description=D3D hook helper for rendering overlays in DirectX 9/10/11 games.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:D3DHook_FontMap
 +
|label=D3DHook_FontMap
 +
|description=Font texture map used by D3D hook rendering.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:D3DHook_Texture
 +
|label=D3DHook_Texture
 +
|description=Texture management for D3D hook sprites.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:D3Dhook_TextContainer
 +
|label=D3Dhook_TextContainer
 +
|description=Text container used to draw text via D3D hook.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:D3DHook_RenderObject
 +
|label=D3DHook_RenderObject
 +
|description=Abstract render object controlling rendering behavior.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:D3DHook_Sprite
 +
|label=D3DHook_Sprite
 +
|description=Rendered sprite/texture displayed via D3D hook.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:Disassembler
 +
|label=Disassembler
 +
|description=Disassembler helper class.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:Disassemblerview
 +
|label=Disassemblerview
 +
|description=Visual disassembler UI used in Memory View.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:DisassemblerviewLine
 +
|label=DisassemblerviewLine
 +
|description=Single line entry in a disassembler view.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:DissectCode
 +
|label=DissectCode
 +
|description=Structure dissection helper.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:Edit
 +
|label=Edit
 +
|description=Single-line text edit control.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:Event
 +
|label=Event
 +
|description=Event wrapper class for callbacks.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:FileStream
 +
|label=FileStream
 +
|description=Stream class for file-based I/O.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:FileDialog
 +
|label=FileDialog
 +
|description=Standard file selection dialog wrapper.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:FindDialog
 +
|label=FindDialog
 +
|description=Search/find dialog class.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:Font
 +
|label=Font
 +
|description=Font definition and metrics class.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:Form
 +
|label=Form
 +
|description=Window/form class.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:FoundList
 +
|label=FoundList
 +
|description=Companion class for MemScan results; reads result files.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:GenericHotkey
 +
|label=GenericHotkey
 +
|description=Register hotkeys with CE's hotkey handler.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:Graphic
 +
|label=Graphic
 +
|description=Abstract base for image/graphic classes.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:GraphicControl
 +
|label=GraphicControl
 +
|description=Lightweight control for simple graphics.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:GroupBox
 +
|label=GroupBox
 +
|description=Panel-like container with a header.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:Hexadecimal
 +
|label=Hexadecimal
 +
|description=Hex display helper used by Memory View.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:Hexadecimalview
 +
|label=Hexadecimalview
 +
|description=Hex display UI component in the Memory View.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:Icon
 +
|label=Icon
 +
|description=Icon resource wrapper.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:Image
 +
|label=Image
 +
|description=Image control for displaying pictures.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:Internet
 +
|label=Internet
 +
|description=Internet client helper class.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:JpegImage
 +
|label=JpegImage
 +
|description=JPEG image handler class.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:Label
 +
|label=Label
 +
|description=Static text label control.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:LuaPipe
 +
|label=LuaPipe
 +
|description=Abstract pipe communication class.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:LuaPipeClient
 +
|label=LuaPipeClient
 +
|description=Client implementation for pipe communication.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:LuaPipeServer
 +
|label=LuaPipeServer
 +
|description=Server implementation for pipe communication.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:ListBox
 +
|label=ListBox
 +
|description=List box control with selectable strings.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:ListColumn
 +
|label=ListColumn
 +
|description=Column descriptor for a ListView.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:ListColumns
 +
|label=ListColumns
 +
|description=Container for ListColumn objects.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:ListItem
 +
|label=ListItem
 +
|description=Entry in a ListView.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:ListItems
 +
|label=ListItems
 +
|description=Container for ListItem objects.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:Listview
 +
|label=Listview
 +
|description=Multi-column list view control.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:MainMenu
 +
|label=MainMenu
 +
|description=Top-level menu bar for a form.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:Memo
 +
|label=Memo
 +
|description=Multi-line text editor control.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:MemScan
 +
|label=MemScan
 +
|description=Memory scanner class for performing scans.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:Menu
 +
|label=Menu
 +
|description=Common ancestor for menu-related classes.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:MenuItem
 +
|label=MenuItem
 +
|description=Menu item descriptor.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:MemoryRecord
 +
|label=MemoryRecord
 +
|description=Cheat table entry describing an address/value/hotkey etc.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:MemoryRecordHotkey
 +
|label=MemoryRecordHotkey
 +
|description=Hotkey interface for a MemoryRecord.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:MemoryStream
 +
|label=MemoryStream
 +
|description=In-memory stream class.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:Memoryview
 +
|label=Memoryview
 +
|description=Memory view (hex editor) window class.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:MultiReadExclusiveWriteSynchronizer
 +
|label=MultiReadExclusiveWriteSynchronizer
 +
|description=Synchronizer for safe concurrent read/write access.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:Object
 +
|label=Object
 +
|description=Root base class for most CE classes.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:PaintBox
 +
|label=PaintBox
 +
|description=Control for custom painting surface.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:PageControl
 +
|label=PageControl
 +
|description=Container for multiple pages/tabs.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:Panel
 +
|label=Panel
 +
|description=Container control for grouping child controls.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:Pen
 +
|label=Pen
 +
|description=Drawing pen used by Canvas for lines.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:Picture
 +
|label=Picture
 +
|description=Container for Graphic objects.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:PopupMenu
 +
|label=PopupMenu
 +
|description=Context (right-click) menu class.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:PortableNetworkGraphic
 +
|label=PortableNetworkGraphic
 +
|description=PNG image class.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:ProgressBar
 +
|label=ProgressBar
 +
|description=Visual progress indicator control.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:RadioGroup
 +
|label=RadioGroup
 +
|description=Group of radio-button controls.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:RasterImage
 +
|label=RasterImage
 +
|description=Base class for raster image controls.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:RIPRelativeScanner
 +
|label=RIPRelativeScanner
 +
|description=Helper for RIP-relative instruction scanning.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:OpenDialog
 +
|label=OpenDialog
 +
|description=File open dialog class.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:SaveDialog
 +
|label=SaveDialog
 +
|description=File save dialog class.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:SelectDirectoryDialog
 +
|label=SelectDirectoryDialog
 +
|description=Directory selection dialog class.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:Semaphore
 +
|label=Semaphore
 +
|description=Semaphore synchronization primitive.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:Settings
 +
|label=Settings
 +
|description=Access and modify Cheat Engine settings and store plugin data.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:Splitter
 +
|label=Splitter
 +
|description=UI splitter control for resizing panels.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:Stringlist
 +
|label=Stringlist
 +
|description=Ordered list container for strings.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:Strings
 +
|label=Strings
 +
|description=Abstract base for text collections.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:StringStream
 +
|label=StringStream
 +
|description=Stream wrapper around a string buffer.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:Structure
 +
|label=Structure
 +
|description=Structure definition class for memory layouts.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:StructureElement
 +
|label=StructureElement
 +
|description=Single element inside a Structure.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:StructureFrm
 +
|label=StructureFrm
 +
|description=Structure editor/dissector form class.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:structGroup
 +
|label=structGroup
 +
|description=Grouping helper for structure elements.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:SymbolList
 +
|label=SymbolList
 +
|description=Symbol lookup class (address ↔ name).
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:TabSheet
 +
|label=TabSheet
 +
|description=Single page within a PageControl.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:TableFile
 +
|label=TableFile
 +
|description=Represents a file stored inside a cheat table.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:Thread
 +
|label=Thread
 +
|description=Thread wrapper class.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:Timer
 +
|label=Timer
 +
|description=Non-visual timer component triggering onTimer events.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:ToggleBox
 +
|label=ToggleBox
 +
|description=Toggleable button-like control.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:TrackBar
 +
|label=TrackBar
 +
|description=Slider control for numeric values.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:TreeNode
 +
|label=TreeNode
 +
|description=Node in a Treeview.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:TreeNodes
 +
|label=TreeNodes
 +
|description=Container for TreeNode objects.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:Treeview
 +
|label=Treeview
 +
|description=Tree view control.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:WinControl
 +
|label=WinControl
 +
|description=Base class for windowed controls.
 +
}}
 +
{{LuaIndexItem
 +
|page=Class:xmplayer
 +
|label=xmplayer
 +
|description=XM player class for tracker music playback.
 +
}}
 +
}}
  
 +
=== SQL Classes ===
 +
{{LuaIndexBox
 +
|title=SQL Classes
 +
|content=
 +
{{LuaIndexItem
 +
|page=SQL:CustomConnection
 +
|label=CustomConnection
 +
|description=Base for custom DB connection implementations.
 +
}}
 +
{{LuaIndexItem
 +
|page=SQL:Database
 +
|label=Database
 +
|description=Database container/manager for connections and datasets.
 +
}}
 +
{{LuaIndexItem
 +
|page=SQL:SQLConnection
 +
|label=SQLConnection
 +
|description=Generic SQL connection abstraction.
 +
}}
 +
{{LuaIndexItem
 +
|page=SQL:SQLite3Connection
 +
|label=SQLite3Connection
 +
|description=SQLite3 connection implementation.
 +
}}
 +
{{LuaIndexItem
 +
|page=SQL:ODBCConnection
 +
|label=ODBCConnection
 +
|description=ODBC data source connection.
 +
}}
 +
{{LuaIndexItem
 +
|page=SQL:DBTransaction
 +
|label=DBTransaction
 +
|description=Transaction object for DB operations.
 +
}}
 +
{{LuaIndexItem
 +
|page=SQL:SQLTransaction
 +
|label=SQLTransaction
 +
|description=SQL-specific transaction object.
 +
}}
 +
{{LuaIndexItem
 +
|page=SQL:Param
 +
|label=Param
 +
|description=Single query parameter object.
 +
}}
 +
{{LuaIndexItem
 +
|page=SQL:Params
 +
|label=Params
 +
|description=Parameter container for queries.
 +
}}
 +
{{LuaIndexItem
 +
|page=SQL:Fields
 +
|label=Fields
 +
|description=Field metadata and values container.
 +
}}
 +
{{LuaIndexItem
 +
|page=SQL:Dataset
 +
|label=Dataset
 +
|description=Abstract dataset representing query results.
 +
}}
 +
{{LuaIndexItem
 +
|page=SQL:DBDataset
 +
|label=DBDataset
 +
|description=Database-backed dataset implementation.
 +
}}
 +
{{LuaIndexItem
 +
|page=SQL:CustomBufDataset
 +
|label=CustomBufDataset
 +
|description=In-memory buffered dataset.
 +
}}
 +
{{LuaIndexItem
 +
|page=SQL:CustomSQLQuery
 +
|label=CustomSQLQuery
 +
|description=Extended/custom SQL query object.
 +
}}
 +
{{LuaIndexItem
 +
|page=SQL:SQLQuery
 +
|label=SQLQuery
 +
|description=Standard SQL query executor and result-holder.
 +
}}
 +
}}
  
closeCE()
+
=== Class Helper Functions ===
Just closes ce
+
{{LuaIndexBox
 +
|title=Class Helper Functions
 +
|content=
 +
{{LuaIndexItem
 +
|page=inheritsFromObject
 +
|label=inheritsFromObject
 +
|description=Returns <code>true</code> if the given object/class inherits from <code>Object</code>.
 +
}}
 +
{{LuaIndexItem
 +
|page=inheritsFromComponent
 +
|label=inheritsFromComponent
 +
|description=Returns <code>true</code> if the object/class inherits from <code>Component</code>.
 +
}}
 +
{{LuaIndexItem
 +
|page=inheritsFromControl
 +
|label=inheritsFromControl
 +
|description=Returns <code>true</code> if the object/class inherits from <code>Control</code>.
 +
}}
 +
{{LuaIndexItem
 +
|page=inheritsFromWinControl
 +
|label=inheritsFromWinControl
 +
|description=Returns <code>true</code> if the object/class inherits from <code>WinControl</code>.
 +
}}
 +
{{LuaIndexItem
 +
|page=createClass
 +
|label=createClass
 +
|description=Creates an instance of the specified registered class (default constructor).
 +
}}
 +
{{LuaIndexItem
 +
|page=createComponentClass
 +
|label=createComponentClass
 +
|description=Creates an instance of the specified component class (owner/parent may be required).
 +
}}
 +
}}
  
 +
=== Undefined Class Property Functions ===
 +
Not all class properties are explicitly exposed; these helpers allow dynamic access to published properties and method/event bindings.
  
hideAllCEWindows() 
+
{{LuaIndexBox
Makes all normal ce windows invisible (e.g trainer table)
+
|title=Undefined Class Property Functions
 
+
|content=
 
+
{{LuaIndexItem
unhideMainCEwindow()
+
|page=getPropertyList
Shows the main cheat engine window
+
|label=getPropertyList
 
+
|description=Returns a [[Lua:Class:StringList|StringList]] of published property names for the specified class.
 
+
}}
getAutoAttachList()
+
{{LuaIndexItem
Returns the AutoAttach StringList object. It can be controlled with the stringlist_ routines (it's not recommended to destroy this list object)
+
|page=setProperty
 
+
|label=setProperty
 
+
|description=Sets the value of a published property on an object instance (not usable for method properties).
 
+
}}
 
+
{{LuaIndexItem
 
+
|page=getProperty
 
+
|label=getProperty
supportCheatEngine(attachwindow, hasclosebutton, width, height, position ,yoururl OPTIONAL, extraparameters OPTIONAL, percentageshown OPTIONAL)
+
|description=Gets the value of a published property on an object instance (not usable for method properties).
  Will show an advertising window which will help keep the development of Cheat Engine going.
+
}}
  If you provide your own url it will be shown Up to 75% of the time.
+
{{LuaIndexItem
 
+
|page=setMethodProperty
 
+
|label=setMethodProperty
  attachwindow Type=Form  The form that the ad is attached to
+
|description=Assigns a Lua function to a method/event property on an object.
  hasclosebutton Type=boolean  If true the window will have a border an a close button at top
+
}}
  width, height Type=integer 
+
{{LuaIndexItem
    The client width and height of the window.
+
|page=getMethodProperty
    Prefered formats are  120x600 , 160x600, 300x250, 468x60, 728x90  ,But you are free to use different formats
+
|label=getMethodProperty
 
+
|description=Retrieves a callable wrapper to invoke the original method/property on the object.
 
+
}}
  Position Type=integer/enum The place of the window
+
}}
    0=Top, 1=Right, 2=Bottom, 3=left
 
 
 
 
 
  Yoururl Type=string The url you want to show. When given instead of showing CE's ads 100% it will show your url up to 75%.
 
    You can use it for your own income, or for updating users about new versions of your trainer or whatever you feel like
 
 
 
 
 
  Extraparameters Type=String  are url request parameters you can add to the default parameters (e.g trainername=mytrainer for tracking purposes) 
 
 
 
 
 
  PercentageShown You can change the default of 75% to a smaller value like 50%
 
 
 
 
 
 
 
 
 
fuckCheatEngine() 
 
Removes the ad window if it was showing
 
 
 
 
 
function onOpenProcess(processid)
 
When this function is defined it will be called each time a process has been opened (note that a process can be opened multiple times in a row, e.g when attaching the debugger it might first open it and then attach the debugger which opens it again...)
 
 
 
 
 
function debugger_onModuleLoad(modulename, baseaddress) 
 
this routine is called when a module is loaded and the debugger is attached. This only works with the Windows debugger interface.
 
Return 1 if you want to cause the debugger to break on module load
 
 
 
 
 
 
 
 
 
 
 
 
 
Disassembler
 
disassemble(address)
 
Disassembles the given address and returns a string in the format of "address - bytes - opcode  extra"
 
 
 
 
 
splitDisassembledString(disassembledstring) Returns 4 strings. The address, bytes, opcode and extra field
 
 
 
 
 
getInstructionSize(address) Returns the size of an instruction (basically it disassembles the instruction and returns the number of bytes for you)
 
 
 
 
 
getPreviousOpcode(address):
 
Returns the address of the previous opcode (this is just an estimated guess)
 
 
 
 
 
 
 
 
 
Internal Cheat Engine functions
 
The following section describes some of CE's internal functions. Only use them if you know what you are doing.
 
 
 
 
 
dbk_initialize() 
 
Returns true if the dbk driver is loaded in memory. False if it failed for whatever reason (e.g 64-bit and not booted with unsigned driver support)
 
 
 
 
 
dbk_useKernelmodeOpenProcess() 
 
Switches the internal pointer of the OpenProcess api to dbk_OpenProcess
 
 
 
 
 
dbk_useKernelmodeProcessMemoryAccess()
 
Switches the internal pointer to the ReadProcessMemory and WriteProcessMemory apis to dbk_ReadProcessMemory and dbk_WriteProcessMemory
 
 
 
 
 
dbk_useKernelmodeQueryMemoryRegions()
 
Switches the internal pointer to the QueryVirtualMemory api to dbk_QueryVirtualMemory
 
 
 
 
 
dbk_getPEProcess(processid) 
 
Returns the pointer of the EProcess structure of the selected processid
 
 
 
 
 
dbk_getPEThread(threadid) 
 
Gets the pointer to the EThread  structure
 
 
 
 
 
dbk_readMSR(msr)
 
Reads the msr
 
 
 
 
 
dbk_writeMSR(msr, msrvalue)
 
Writes the msr
 
 
 
 
 
dbk_executeKernelMemory(address, parameter) 
 
Executes a routine from kernelmode (e.g a routine written there with auto assembler)
 
parameter can be a value or an address. It's up to your code how it's handled
 
 
 
 
 
 
 
 
 
 
 
 
 
dbvm_initialize(offloados OPTIONAL)
 
Initializes the dbvm functions (dbk_initialize also calls this) offloados is a boolean that when set will offload the system onto dbvm if it's not yet running (and only IF the dbk driver is loaded)
 
 
 
 
 
dbvm_readMSR(msr)
 
See dbk_readMSR
 
 
 
 
 
dbvm_writeMSR(msr, value)
 
See dbk_writeMSR
 
 
 
 
 
 
 
 
 
 
 
 
 
onAPIPointerChange(function):  
 
Registers a callback when an api pointer is changed (can happen when the user clicks ok in settings, or when dbk_use*** is used. Does NOT happen when setAPIPointer is called)
 
 
 
 
 
 
 
 
 
setAPIPointer(functionid, address)
 
Sets the pointer of the given api to the given address. The address can be a predefined address set at initialization by Cheat Engine, or an address you got from an autoassembler script or injected dll (When Cheat Engine itself was targeted)
 
 
 
 
 
functionid:
 
  0: OpenProcess
 
    Known compatible address defines:
 
      windows_OpenProcess
 
      dbk_OpenProcess
 
     
 
  1: ReadProcessMemory
 
    Known compatible address defines:
 
      windows_ReadProcessMemory
 
      dbk_ReadProcessMemory
 
      dbk_ReadPhysicalMemory
 
      dbvm_ReadPhysicalMemory
 
 
 
 
 
  2: WriteProcessMemory
 
    Known compatible address defines:
 
      windows_WriteProcessMemory
 
      dbk_WriteProcessMemory
 
      dbk_WritePhysicalMemory
 
      dbvm_WritePhysicalMemory
 
 
 
 
 
  3: VirtualQueryEx
 
    Known compatible address defines:
 
      windows_VirtualQueryEx
 
      dbk_VirtualQueryEx
 
      VirtualQueryExPhysical
 
 
 
 
 
Extra lua variables defined:
 
dbk_NtOpenProcess : Address of the NtOpenProcess implementation in DBK32
 
 
 
 
 
 
 
 
 
The dbvm_ addresses should only be used with auto assembler scripts injected into Cheat Engine
 
dbvm_block_interrupts
 
Address of function dbvm_block_interrupts : DWORD; stdcall; 
 
 
 
 
 
dbvm_raise_privilege
 
Address of function dbvm_raise_privilege : DWORD; stdcall; 
 
 
 
 
 
dbvm_restore_interrupts
 
Address of function dbvm_restore_interrupts : DWORD; stdcall;
 
 
 
 
 
dbvm_changeselectors
 
Address of function dbvm_changeselectors(cs,ss,ds,es,fs,gs: dword): DWORD; stdcall;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Object Oriented Functions
 
 
 
 
 
class helper functions
 
inheritsFromObject(class)
 
Returns true if given any class
 
 
 
 
 
inheritsFromComponent(class)
 
Returns true if the given object inherits from the Component class
 
 
 
 
 
inheritsFromControl(class)
 
Returns true if the given object inherits from the Control class
 
 
 
 
 
inheritsFromWinControl(class)
 
Returns true if the given object inherits from the WinControl class
 
 
 
 
 
getFormCount()
 
Returns the total number of forms assigned to the main CE application
 
 
 
 
 
getForm(index)
 
Returns the form at the specific index
 
 
 
 
 
getMemoryViewForm() 
 
Returns the main memoryview form class object which can be accessed using the Form_ class methods and the methods of the classes it inherits from. There can be multiple memory views, but this will only find the original/base
 
 
 
 
 
getMainForm()
 
Returns the main form class object which can be accessed using the Form_ class methods and the methods of the classes it inherits from
 
 
 
 
 
getAddressList()
 
Returns the cheat table addresslist object
 
 
 
 
 
getFreezeTimer()
 
Returns the Timer object responsible for freezing values
 
 
 
 
 
getUpdateTimer()
 
Returns the Timer object responsible for updating the value list
 
 
 
 
 
 
 
 
 
Class definitions
 
 
 
 
 
Object class (Inheritance )
 
Most basic class. Basically all classes inherit from this class. Therefore, object_destroy will work on everything
 
 
 
 
 
object_getClassName(object)
 
Returns the classname of the given object
 
 
 
 
 
object_destroy(object)
 
Destroys the object (basically everything inherits from this class)
 
 
 
 
 
 
 
 
 
Component Class (Inheritance Object)
 
component_getComponentCount(Component) 
 
Returns the number of components attached to his component
 
 
 
 
 
component_getComponent(Component, index) 
 
Returns the specific component
 
 
 
 
 
component_findComponentByName(component, name) 
 
Returns the component with this name
 
 
 
 
 
component_getName(Component)
 
Return the name
 
 
 
 
 
component_setName(Component, newname) 
 
Changes the name
 
 
 
 
 
component_getTag(Component) 
 
Sets an integer value. You can use this for ID's or whatever storage you feel like
 
 
 
 
 
component_setTag(Component, tagvalue) 
 
Get the tag value
 
 
 
 
 
component_getOwner(Component)
 
Returns the owner of this component
 
 
 
 
 
 
 
 
 
 
 
 
 
Control Class (Inheritance Component->Object)
 
control_setCaption(control, caption) 
 
Sets the text on a control. All the gui objects fall in this category
 
 
 
 
 
control_getCaption(control) 
 
Returns the text of the control
 
 
 
 
 
control_setPosition(control, x,y)
 
Sets the x and y position of the object base don the top left position (relative to the client array of the owner object)
 
 
 
 
 
control_getPosition(contron) Returns the x and y position of the object (relative to the client array of the owner object)
 
 
 
 
 
control_setSize(control, width,height) 
 
Sets the width and height of the control
 
 
 
 
 
control_getSize(control) 
 
Sets the size of the control
 
 
 
 
 
control_setAlign(control, alignmentoption)
 
Sets the alignment of the control
 
 
 
 
 
control_getAlign(control, alignmentoption)
 
Gets the alignment of the control
 
 
 
 
 
control_getEnabled(control) 
 
Gets the enabled state of the control
 
 
 
 
 
control_setEnabled(control, boolean) 
 
Sets the enabled state of the control
 
 
 
 
 
control_getVisible(control)
 
Gets the visible state of the control
 
 
 
 
 
control_setVisible(control, boolean)
 
Sets the visible state of the control
 
 
 
 
 
control_getColor(control)
 
Gets the color
 
 
 
 
 
control_setColor(control, rgb)
 
Sets the color
 
 
 
 
 
control_getParent(control)
 
Returns nil or an object that inherits from the Wincontrol class
 
 
 
 
 
control_setParent(control)
 
Sets the parent for this control
 
 
 
 
 
control_getPopupMenu(control)
 
Gets the assigned popup menu to this control
 
 
 
 
 
control_setPopupMenu(control)
 
Sets the popup menu for this control
 
 
 
 
 
control_onClick(control, functionnameorstring)
 
Sets the onclick routine
 
  function (sender)
 
 
 
 
 
 
 
 
 
WinControl Class (Inheritance Control->Component->Object)
 
wincontrol_getControlCount(control) 
 
Returns the number of Controls attached to this class
 
 
 
 
 
wincontrol_getControl(control,index)
 
Returns a WinControl class object
 
 
 
 
 
wincontrol_canFocus(control)
 
Returns true if the object can be focused
 
 
 
 
 
wincontrol_focused(control)
 
Returns boolean true when focused
 
 
 
 
 
wincontrol_setFocus(control)
 
Tries to set keyboard focus the object
 
 
 
 
 
wincontrol_onEnter(control, function) 
 
Sets an onEnter event. (Triggered on focus enter)
 
  function (sender)
 
 
 
 
 
wincontrol_onExit(control, function) 
 
Sets an onExit event. (Triggered on lost focus)
 
  function (sender)
 
 
 
 
 
 
 
 
 
GenericHotkey Class  (Inheritance  Object)
 
The genericHotkey class lets you register hotkeys to Cheat Engine's internal hotkey handler
 
 
 
 
 
createHotkey(function, key, ...)
 
Returns an initialized GenericHotkey class object. Maximum of 5 keys
 
 
 
 
 
generichotkey_setKeys(hotkey, key, ....)
 
Changes the keys on a Hotkey class object
 
 
 
 
 
generichotkey_onHotkey(hotkey, function)
 
Changes the function called for a Hotkey class object
 
  function (sender)
 
 
 
 
 
 
 
 
 
 
 
 
 
MenuItem class(Inheritance Component->Object)
 
The menuItem class holds the manuitems of a Menu, PopupMenu or even another MenuItem
 
 
 
 
 
createMenuItem(ownermenu) 
 
Creates a menu item that gets added to the owner menu (See Menu class)
 
 
 
 
 
menuItem_getCaption(menuitem) 
 
Gets the caption of the menu item
 
 
 
 
 
menuItem_setCaption(menuitem, caption) 
 
Sets the caption of the menu item
 
 
 
 
 
menuItem_getShortcut(menuitem)
 
Returns the shortcut for this menu item
 
 
 
 
 
menuItem_setShortcut(menuitem, shortcut)
 
Sets the shortcut for this menuitem. A shortcut is a string in the form of ("ctrl+x")
 
 
 
 
 
menuItem_getCount(menuitem)
 
Returns the number of child menuitems it has
 
 
 
 
 
menuItem_getItem(menuitem, index)
 
Returns the menuitem object at the given index
 
 
 
 
 
menuItem_add(menuItem, menuItem) 
 
Adds a menuItem as a submenu item
 
 
 
 
 
menuItem_delete(menuitem, index)
 
 
 
 
 
menuItem_onClick(menuitem, function) 
 
Sets an onClick event
 
  function (sender)
 
 
 
 
 
 
 
 
 
Menu Class (Inheritance Component->Object)
 
The menu class object is the common Class ancestor for the MainMenu and PopupMenu classes
 
 
 
 
 
menu_getItems(menu) 
 
Returns the MenuItem of this Menu
 
 
 
 
 
 
 
 
 
MainMenu Class (Inheritance Menu->Component->Object)
 
The MainMenu class is the menu at the top of a form
 
 
 
 
 
createMainMenu(form)
 
The mainmenu is the menu at the top of a window
 
 
 
 
 
 
 
 
 
PopupMenu Class (Inheritance Menu->Component->Object)
 
The PopupMenu class is the menu that shows when rightclicking on an object
 
 
 
 
 
createPopupMenu(owner)
 
The popup menu is the menu that popus up when showing the (rightclick) context of an control
 
 
 
 
 
 
 
 
 
Strings Class (Inheritance  Object) (Mostly an abstract class)
 
The strings class is an abstract class that some text based classes make use of. Because it is abstract it can not be created directly, but only by the child classes that inherit from it
 
 
 
 
 
strings_clear(list) 
 
Deletes all strings in the list
 
 
 
 
 
strings_add(list, string) 
 
Adds a string to the list
 
 
 
 
 
strings_delete(list, index)
 
Deletes a string from the list
 
 
 
 
 
strings_getText(strings) 
 
Returns all the strings as one big string
 
 
 
 
 
strings_setText(strings) 
 
Sets the strings of the given strings object to the given text (can be multiline)
 
 
 
 
 
strings_indexOf(list, string)
 
Returns the index of the specified string. Returns -1 if not found
 
 
 
 
 
strings_insert(list, index, string)
 
Inserts a string at a specific spot moving the items after it
 
 
 
 
 
strings_getCount(list)
 
Returns the number is strings in the list
 
 
 
 
 
strings_remove(list, string)
 
Removes the given string from the list
 
 
 
 
 
strings_loadFromFile(list, filename)
 
Load the strings from a textfile
 
 
 
 
 
strings_saveToFile(list, filename) 
 
Save the strings to a textfile
 
 
 
 
 
strings_getString(list, index) 
 
Gets the string at the given index
 
 
 
 
 
strings_setString(list, index, string)
 
Replaces the string at the given index
 
 
 
 
 
 
 
 
 
Stringlist Class (Inheritance  Strings->Object)
 
Inherits from the Strings class and adds some properties that define on what to do when an item is added.
 
 
 
 
 
createStringlist() 
 
Creates a stringlist class object (for whatever reason, lua strings are probably easier to use)
 
 
 
 
 
stringlist_getDuplicates(list) 
 
Returns the duplicates property
 
 
 
 
 
stringlist_setDuplicates(list, Duplicates) 
 
Sets the duplicates property
 
  dupIgnore: Don't add duplicates
 
  dupAccept: Add duplicates
 
  dupError: Raise an exception when adding duplicates
 
 
 
 
 
stringlist_getSorted(list) 
 
Returns true if the list has the sorted property
 
 
 
 
 
stringlist_setSorted(list, boolean) 
 
Sets the sorted property
 
 
 
 
 
stringlist_getCaseSensitive(list) 
 
Returns true if the case sensitive property is set
 
 
 
 
 
stringlist_setCaseSensitive(list, boolean)
 
Sets the case sensitive property
 
 
 
 
 
 
 
 
 
 
 
 
 
Form Class (Inheritance ScrollingWinControl->CustomControl->WinControl->Control->Component->Object)
 
The Form class is a window
 
 
 
 
 
createForm(visible OPT)
 
Creates a Form class object(window) and returns the pointer for it. Visible is default true but can be changed
 
 
 
 
 
createFormFromFile(filename)
 
Creates a Form class object and initializes it based on the data in the given file.
 
It returns the generated form
 
 
 
 
 
form_saveToFile(form, filename)
 
Saves a userdefined form. (DOES NOT WORK ON NORMAL FORMS LIKE MAINFORM)
 
 
 
 
 
form_centerScreen(form)
 
Places the form at the center of the screen
 
 
 
 
 
form_hide(form) 
 
Hide the form
 
 
 
 
 
form_show(form) 
 
Show the form
 
 
 
 
 
form_showModal(form)
 
Show the form and wait for it to close and get the close result
 
 
 
 
 
form_isForegroundWindow(form)
 
eturns true if the specified form has focus
 
 
 
 
 
form_onClose(form, function) 
 
function (sender)  Return a CloseAction to determine how to close the window
 
 
 
 
 
form_getMenu(form) 
 
Returns the mainmenu object of this form
 
 
 
 
 
form_setMenu(form, mainmenu)
 
Sets a menu for the form
 
 
 
 
 
 
 
 
 
GraphicControl Class (Inheritance Control->Component->Object)
 
graphicControl_getCanvas(graphiccontrol) 
 
Returns the Canvas object for the given object that has inherited from customControl
 
 
 
 
 
 
 
 
 
Label Class (Inheritance GraphicControl->Control->Component->Object)
 
The Label class is a visual component that lets you display text
 
 
 
 
 
createLabel(owner)
 
Creates a Label class object which belongs to the given owner. Owner can be any object inherited from WinControl
 
 
 
 
 
 
 
 
 
Splitter Class (Inheritance CustomControl->WinControl->Control->Component->Object)
 
The Splitter class is a visual component that lets the user resize neighbouring components)
 
 
 
 
 
createSplitter(owner)
 
Creates a Splitter class object which belongs to the given owner. Owner can be any object inherited from WinControl
 
 
 
 
 
 
 
 
 
Panel Class (Inheritance CustomControl->WinControl->Control->Component->Object)
 
The Panel class is like a form which can contain visual components.
 
 
 
 
 
createPanel(owner)
 
Creates a Panel class object which belongs to the given owner. Owner can be any object inherited from WinControl
 
 
 
 
 
panel_getAlignment(panel)
 
Gets the alignment property
 
 
 
 
 
panel_setAlignment(panel, alignment)
 
Sets the alignment property
 
 
 
 
 
panel_getBevelInner(panel)
 
Gets the BevelInner property
 
 
 
 
 
panel_setBevelInner(panel, PanelBevel)
 
Sets the BevelInner property
 
 
 
 
 
panel_getBevelOuter(panel)
 
Gets the BevelOuter property
 
 
 
 
 
panel_setBevelOuter(panel, PanelBevel)
 
Sets the BevelOuter property
 
 
 
 
 
panel_getBevelWidth(panel)
 
Gets the BevelWidth property
 
 
 
 
 
panel_setBevelWidth(panel, BevelWidth)
 
Sets the BevelWidth property
 
 
 
 
 
panel_getFullRepaint(panel)
 
Gets the FullRepaint property
 
 
 
 
 
panel_setFullRepaint(panel, boolean)
 
Sets the FullRepaint property
 
 
 
 
 
 
 
 
 
 
 
 
 
Image Class (Inheritance GraphicControl->Control->Component->Object)
 
The Image class is a visual component that lets you show an image
 
 
 
 
 
createImage(owner) Creates an Image class object which belongs to the given owner. Owner can be any object inherited from WinControl
 
 
 
 
 
image_loadImageFromFile(image, filename)
 
Loads an image from the given filename
 
 
 
 
 
image_stretch(image, boolean)
 
Sets the stretch property. If true it will stretch the image to the dimension of the Image component
 
 
 
 
 
image_transparent(image, boolean)
 
Sets the transparency property.
 
 
 
 
 
image_getCanvas(image)
 
Gets the Canvas class object that belong to this image
 
 
 
 
 
image_getPicture(image) 
 
Returns the Picture object of this image (You can use this to load a stream)
 
 
 
 
 
 
 
 
 
Edit Class (Inheritance WinControl->Control->Component->Object)
 
The Edit class is a visual component that lets the user type in data (Use control_getCaption to get the user input)
 
 
 
 
 
createEdit(owner)
 
Creates an Edit class object which belongs to the given owner. Owner can be any object inherited from WinControl
 
 
 
 
 
edit_clear(edit)
 
Clears the edit field
 
 
 
 
 
edit_selectAll(edit)
 
Selects everything in the edit field
 
 
 
 
 
edit_clearSelection(edit)
 
Deleted the selected text in an editfield
 
 
 
 
 
edit_copyToClipboard(edit)
 
Copies the selected text in the edit field to the clipboard
 
 
 
 
 
edit_cutToClipboard(edit)
 
Copies the selected text in the edit field to the clipboard and then deletes it from the edit field
 
 
 
 
 
edit_pasteFromClipboard(edit)
 
Past the contents of the clipboard into the edit field
 
 
 
 
 
edit_onChange(edit, function)
 
Registers an onChange event
 
  function (sender)
 
 
 
 
 
 
 
 
 
Memo Class (Inheritance Edit->WinControl->Control->Component->Object)
 
The Memo class is a multiline edit field
 
 
 
 
 
createMemo(owner)
 
Creates a Memo class object which belongs to the given owner. Owner can be any object inherited from WinControl
 
 
 
 
 
memo_append(memo,string)
 
Adds a line to the end of the memo object
 
 
 
 
 
memo_getLines(memo) 
 
returns a class inherited from the Strings object. Adding and reading strings from this class will affect the memo
 
 
 
 
 
memo_getWordWrap(memo)
 
Gets the WordWrap property
 
 
 
 
 
memo_setWordWrap(memo, boolean)
 
Sets the WordWrap property
 
 
 
 
 
memo_getWantTabs(memo)
 
Gets the WantTabs property
 
 
 
 
 
memo_setWantTabs(memo, boolean)
 
Sets the WantTabs property
 
 
 
 
 
memo_getWantReturns(memo)
 
Gets the WantReturns property
 
 
 
 
 
memo_setWantReturns(memo, boolean)
 
Sets the WantReturns property
 
 
 
 
 
memo_getScrollbars(memo)
 
Gets the Scrollbard property
 
 
 
 
 
memo_setScrollbars(memo, scrollbarenumtype) 
 
Sets the scrollbars property. Horizontal only takes affect when wordwrap is disabled
 
valid enum types
 
    ssNone:  No scrollbars
 
    ssHorizontal: Has a horizontal scrollbar
 
    ssVertical: Has a vertical scrollbar
 
    ssBoth: Has both scrollbars
 
    ssAutoHorizontal: Same as above but only shows when there actually is something to scroll for
 
    ssAutoVertical: " " " " ...
 
    ssAutoBoth: " " " " ...
 
 
 
 
 
 
 
 
 
 
 
 
 
ButtonControl Class (Inheritance WinControl->Control->Component->Object)
 
Common ancestor of several button like objects.
 
 
 
 
 
 
 
 
 
Button Class (Inheritance ButtonControl->WinControl->Control->Component->Object)
 
The button class is a visual component in the shape of a button.
 
 
 
 
 
createButton(owner)
 
Creates a Button class object which belongs to the given owner. Owner can be any object inherited from WinControl
 
 
 
 
 
button_getModalResult(button)
 
Returns the ModalResult value of this button
 
 
 
 
 
button_setModalResult(button, mr)
 
Sets the ModalResult value of this button. ModalResult will close a Modal form and make it return the ModalResult. It has no effect on a normal form
 
 
 
 
 
 
 
 
 
CheckBox Class (Inheritance ButtonControl->WinControl->Control->Component->Object)
 
The Checkbox is a visual component that lets the user click it and change state between checked, unchecked, and if possible, grayed
 
 
 
 
 
createCheckBox(owner)
 
Creates a CheckBox class object which belongs to the given owner. Owner can be any object inherited from WinControl
 
 
 
 
 
checkbox_getAllowGrayed(CheckBox)
 
Gets the AllowGrayed property
 
 
 
 
 
checkbox_setAllowGrayed(CheckBox, boolean)
 
Sets the AllowGrayed property
 
 
 
 
 
checkbox_getState(checkbox)
 
Gets the current state of the checkbox
 
  0=Unchecked
 
  1=Checked
 
  2=Grayed
 
 
 
 
 
checkbox_setState(checkbox, state)
 
Sets the state of the checkbox
 
  0=Unchecked
 
  1=Checked
 
  2=Grayed
 
 
 
 
 
checkbox_onChange(checkbox, function)
 
Sets an OnChange event for the checkbox that gets triggered when the state has been changed (by the user of programatically)
 
  function (sender)
 
 
 
 
 
 
 
 
 
ToggleBox Class (Inheritance CheckBox->ButtonControl->WinControl->Control->Component->Object)
 
The togglebox is like a button, but can stay down. Use with the checkbox methods
 
 
 
 
 
createToggleBox(owner) Creates a ToggleBox class object which belongs to the given owner. Owner can be any object inherited from WinControl
 
 
 
 
 
 
 
 
 
GroupBox Class (Inheritance WinControl->Control->Component->Object)
 
The groupbox class is like a Panel, but then has a header on top
 
 
 
 
 
createGroupBox(owner) Creates a GroupBox class object which belongs to the given owner. Owner can be any object inherited from WinControl
 
 
 
 
 
 
 
 
 
RadioGroup Cass (Inheritance GroupBox->WinControl->Control->Component->Object)
 
The radiogroup is like a GroupBox but autopopulated using the Items(Strings object)
 
 
 
 
 
createRadioGroup(owner)
 
Creates a RadioGroup class object which belongs to the given owner. Owner can be any object inherited from WinControl
 
 
 
 
 
radiogroup_getRows(radiogroup)
 
Returns the number of rows
 
 
 
 
 
radiogroup_getItems(radiogroup)
 
Returns a Strings object
 
 
 
 
 
radiogroup_getColumns(radiogroup)
 
Returns the number of columns
 
 
 
 
 
radiogroup_setColumns(radiogroup, count)
 
Sets the number of columns
 
 
 
 
 
radiogroup_onClick(radiogroup, function)
 
Registers an OnClick event handler
 
  function (sender)
 
 
 
 
 
ListBox Class (Inheritance WinControl->Control->Component->Object)
 
The listbox class is a visual component with a list of selectable strings
 
 
 
 
 
createListBox(owner) Creates a ListBox class object which belongs to the given owner. Owner can be any object inherited from WinControl
 
 
 
 
 
listbox_clear(listbox)
 
Clears the whole listbox
 
 
 
 
 
listbox_getItems(listbox)
 
Returns a strings object you can use to add and remove strings
 
 
 
 
 
listbox_getItemIndex(listbox)
 
Returns the current selected stringnumber (counted from 0, -1 is no selection)
 
 
 
 
 
listbox_setItemIndex(listbox,index)
 
Sets the currently selected string (-1 is no selection)
 
 
 
 
 
listbox_getCanvas(listbox)
 
Returns the Canvas class object of this listbox
 
 
 
 
 
 
 
 
 
ComboBox Class (Inheritance WinControl->Control->Component->Object)
 
The Combobox is like a edit field with a listbox attached to it
 
 
 
 
 
createComboBox(owner) Creates a ComboBox class object which belongs to the given owner. Owner can be any object inherited from WinControl
 
 
 
 
 
combobox_clear(combobox)
 
Clears all entries in the combobox
 
 
 
 
 
combobox_getItems(combobox)
 
Return the Strings object used to control the list
 
 
 
 
 
combobox_getItemIndex(combobox)
 
Gets the currently selected object in the list
 
 
 
 
 
combobox_setItemIndex(combobox)
 
Sets the currently selected object in the list
 
 
 
 
 
combobox_getCanvas(combobox)
 
Returns the Canvas class object of this combobox
 
 
 
 
 
 
 
 
 
 
 
 
 
ProgressBar Class (Inheritance WinControl->Control->Component->Object)
 
The progressbar class is a visual representation for a bar that can show the current progress on something
 
 
 
 
 
createProgressBar(owner) Creates a ProgressBar class object which belongs to the given owner. Owner can be any object inherited from WinControl
 
 
 
 
 
progressbar_stepIt(progressbar)
 
 
 
 
 
progressbar_stepBy(progressbar, delta)
 
 
 
 
 
progressbar_getMax(progressbar)
 
 
 
 
 
progressbar_setMax(progressbar, integer)
 
 
 
 
 
progressbar_getMin(progressbar)
 
 
 
 
 
progressbar_setMin(progressbar, integer)
 
 
 
 
 
progressbar_getPosition(progressbar)
 
 
 
 
 
progressbar_setPosition(progressbar, integer)
 
 
 
 
 
 
 
 
 
 
 
 
 
TrackBar Class  (Inheritance WinControl->Control->Component->Object)
 
createTrackBar(owner) Creates a TrackBar class object which belongs to the given owner. Owner can be any object inherited from WinControl
 
 
 
 
 
trackbar_getMax(trackbar)
 
 
 
 
 
trackbar_setMax(trackbar, integer)
 
 
 
 
 
trackbar_getMin(trackbar)
 
trackbar_setMin(trackbar, integer)
 
 
 
 
 
trackbar_getPosition(progressbar)
 
 
 
 
 
trackbar_setPosition(progressbar, integer)
 
 
 
 
 
trackbar_onChange(trackbar, function)
 
  function (sender)
 
 
 
 
 
 
 
 
 
CollectionItem Class (Inheritance Object)
 
usually not used by lua users but just defining it here for future usage
 
 
 
 
 
 
 
 
 
 
 
 
 
ListColumn Class (Inheritance CollectionItem->Object)
 
The listcolumn class is an implemented CollectionItem class which is used by the ListColumns class of the listview class
 
 
 
 
 
listcolumn_setAutosize(listcolumns, boolean)
 
 
 
 
 
listcolumn_getCaption(listcolumns)
 
 
 
 
 
listcolumn_setCaption(listcolumns, caption)
 
 
 
 
 
listcolumn_getMaxWidth(listcolumns)
 
 
 
 
 
listcolumn_setMaxWidth(listcolumns, width)
 
 
 
 
 
listcolumn_getMinWidth(listcolumns)
 
 
 
 
 
listcolumn_setMinWidth(listcolumns, width)
 
 
 
 
 
listcolumn_getWidth(listcolumns)
 
 
 
 
 
listcolumn_setWidth(listcolumns, width)
 
 
 
 
 
 
 
 
 
 
 
 
 
Collection Class (Inheritance TObject)
 
The Collection class is an abstract class that the ListColumns class implements (And perhaps other classes as well)
 
 
 
 
 
collection_clear(collection)
 
 
 
 
 
collection_getCount(collection)
 
 
 
 
 
collection_delete(collection, index)
 
 
 
 
 
 
 
 
 
ListColumns class  (Inheritance Collection->Object)
 
The ListColumns class contains the Column class objects of a ListView object
 
 
 
 
 
listcolumns_add(listcolumns)
 
Returns a new ListColumn object
 
 
 
 
 
listcolumns_getColumn(listcolumns, index)
 
Returns a ListColum object;
 
 
 
 
 
 
 
 
 
ListItem Class  (Inheritance TObject)
 
The ListItem class object is an entry in a ListView. It contains the text for the first column and has a Strings object for the subitems
 
listitem_delete(listitem)
 
 
 
 
 
listitem_getCaption(listitem)
 
 
 
 
 
listitem_setCaption(listitem, string)
 
 
 
 
 
listitem_getSubItems(listitem)
 
Returns a Strings object
 
 
 
 
 
 
 
 
 
ListItems class  (Inheritance TObject)
 
The listItems class is a container for the ListItem class objects of a Listview
 
listitems_clear(listitems)
 
listitems_getCount(listitems)
 
listitems_add(listitems) Returns a new ListItem object
 
 
 
 
 
 
 
 
 
 
 
 
 
Listview Class  (Inheritance WinControl->Control->Component->Object)
 
The listview class lets you have a listbox like component with resizable columns. The items and columns inside a listview are special classes themself
 
 
 
 
 
createListView(owner)
 
Creates a ListView class object which belongs to the given owner. Owner can be any object inherited from WinControl
 
 
 
 
 
listview_clear(listview)
 
 
 
 
 
listview_getColumns(listview)
 
Returns a ListColumns object
 
 
 
 
 
listview_getItems(listview) 
 
Returns a ListItems object
 
 
 
 
 
listview_getItemIndex(listview)
 
 
 
 
 
listview_setItemIndex(listview, index)
 
 
 
 
 
listview_getCanvas(listview)
 
 
 
 
 
 
 
 
 
Timer Class  (Inheritance Component->object)
 
The timer class is an non visual component that when active triggers an onTimer event every few milliseconds, base don the given interval
 
 
 
 
 
createTimer(owner, enabled OPT)
 
Creates a timer object. If enabled is not given it will be enabled by default (will start as soon as an onTimer event has been assigned)
 
Owner may be nil, but you will be responsible for destroying it
 
 
 
 
 
timer_setInterval(timer, interval)
 
Sets the speed on how often the timer should trigger. In milliseconds (1000=1 second)
 
 
 
 
 
timer_getEnabled(timer)
 
Returns true if the timer is enabled
 
 
 
 
 
timer_setEnabled(timer, boolean)
 
Lets you enable of disable the timer
 
 
 
 
 
timer_onTimer(timer, function)
 
  function (sender)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
CustomControl class (CustomControl->WinControl->Control->Component->Object)
 
Class some other classes inherit from
 
 
 
 
 
customControl_getCanvas(customcontrol) 
 
Returns the Canvas object for the given object that has inherited from customControl
 
 
 
 
 
 
 
 
 
Canvas Class  (Inheritance CustomCanvas->Object)
 
The canvas class is a graphical class. It allows you do draw lines, pictures, and text on top of other object. Usually used in onPaint events and other graphical events
 
 
 
 
 
canvas_getBrush(canvas)
 
Returns the brush object of this canvas
 
 
 
 
 
canvas_getPen(canvas)
 
Returns the pen object of this canvas
 
 
 
 
 
canvas_getFont(canvas)
 
Returns the font object of this canvas
 
 
 
 
 
canvas_getWidth(canvas)
 
Returns the width of the canvas
 
 
 
 
 
canvas_getHeight(canvas)
 
Returns the height of the canvas
 
 
 
 
 
canvas_getPenPosition(canvas)
 
Returns the current x and y position of the Pen object in the canvas
 
 
 
 
 
canvas_setPenPosition(canvas, x,y)
 
Sets the x and y position of the Pen object in the canvas
 
 
 
 
 
canvas_line(canvas, sourcex, sourcey, destinationx, destinationy)
 
Draws a line on the canvas using the current Pen object's color from source to destination
 
 
 
 
 
canvas_lineTo(destinationx, destinationy)
 
Draws a line on the canvas using the current Pen's color and position
 
 
 
 
 
canvas_rect(x1,y1,x2,y2)
 
Draws a rectangle
 
 
 
 
 
canvas_fillRect(x1,y1,x2,y2)
 
Draws a filled rectangle
 
 
 
 
 
canvas_textOut(x,y, text)
 
Writes a piece of text at the given position
 
 
 
 
 
canvas_getTextWidth(canvas, text)
 
Returns the width of the text you give. Use it to figure out if the given string will fit
 
 
 
 
 
canvas_getTextHeight(canvas, text)
 
Returns the height of the text you give
 
 
 
 
 
canvas_getPixel(canvas, x,y)
 
Returns the RGB or 'Special' color at the current X, Y position
 
 
 
 
 
canvas_setPixel(canvas, x,y,color)
 
Lets you set the color of a specific pixel. (RGB or a 'special' color)
 
 
 
 
 
canvas_floodFill(canvas, x,y)
 
 
 
 
 
canvas_ellipse(canvas, x1,y1,x2,y2)
 
 
 
 
 
canvas_gradientFill(canvas, x1,y1,x2,y2, startcolor, stopcolor, direction) 
 
Gradient fills a rectangle. Direction can be 0 or 1. 0=Vertical 1=Horizontal
 
 
 
 
 
canvas_copyRect(dest_canvas, dest_x1,dest_y1,dest_x2,dest_y2, sourceCanvas, source_x1,source_y1,source_x2,source_y2)
 
 
 
 
 
canvas_draw(canvas, x,y, graphic) 
 
Draw the image of a specific Graphic class
 
 
 
 
 
 
 
 
 
Pen Class  (Inheritance CustomPen->CanvasHelper->Object)
 
The Pen class is part of the Canvas object. It's used to draw lines
 
 
 
 
 
pen_getColor(pen)
 
pen_setColor(pen, color)
 
pen_getWidth(pen)
 
pen_setWidth(pen, width)
 
 
 
 
 
 
 
 
 
Brush Class  (Inheritance CustomBrush->CanvasHelper->Object)
 
The brush class is part of the Canvas object. It's used to fill surfaces
 
brush_getColor(pen)
 
brush_setColor(pen,color)
 
 
 
 
 
Font Class  (Inheritance CustomFont->CanvasHelper->Object)
 
font_getName(font)
 
font_setName(font, fontname)
 
font_getSize(font)
 
font_setSize(font, size)
 
 
 
 
 
 
 
 
 
Graphic Class  (Inheritance Object) 
 
Abstract class (Nothing to concern yourself with, just showing that this class exists)
 
 
 
 
 
Picture Class  (Inheritance Object) 
 
Container for the Graphic class
 
 
 
 
 
createPicture()
 
 
 
 
 
picture_loadFromFile(picture, filename)
 
 
 
 
 
picture_loadFromStream(stream, originalextension OPTIONAL)
 
 
 
 
 
picture_assign(picture, sourcepicture)
 
 
 
 
 
picture_getGraphic(picture)
 
Gets the Graphic object of this picture
 
 
 
 
 
 
 
 
 
OpenDialog Class (Inheritance FileDialog->CommonDialog->Component->Object)
 
The OpenDialog class is used to let the user select a file to open
 
 
 
 
 
opendialog_execute(openDialog)
 
Shows the Open dialog and returns the string to the selected file
 
 
 
 
 
SaveDialog Class (Inheritance OpenDialog->FileDialog->CommonDialog->Component->Object)
 
The SaveDialog class is a copy of the OpenDialog class but is used to select a file for saving
 
 
 
 
 
 
MemoryStream Class (Inheritance Stream->Object)
 
The memorystream class is a Stream class that is stored completely in memory. Because it's a stream there are multiple functions that can work with it
 
 
 
 
 
FileStream Class (Inheritance HandleStream->Stream->Object)
 
The FileStream class is a Stream class that is linked to an open file on disk
 
 
 
 
 
 
 
 
 
TableFile Class (Inheritance Object)
 
Tablefiles are files stored into a Cheat Table. You can access the data of such a file using this class
 
 
 
 
 
findTableFile(filename)
 
Returns the TableFile class object for the saved file
 
 
 
 
 
tablefile_saveToFile(tablefile, filename)
 
tablefile_getData(tablefile, filename) 
 
Gets a MemoryStream object of this TableFile
 
 
 
 
 
 
 
 
 
CheatComponent Class (Inheritance WinControl->Control->Component->Object)
 
The cheatcomponent class is the component used in Cheat Engine 5.x trainers
 
Most people will probably want to design their own components but for those that don't know much coding and use the autogenerated trainer this will be used
 
 
 
 
 
cheatcomponent_setActive(cheatcomponent, boolean, deactivatetime OPTIONAL) 
 
sets the cheat object's Active color to enabled or disabled. The deactivatetime parameter turns the active color off automatically after the given time in milliseconds (e.g one hit cheats like increase by)
 
 
 
 
 
cheatcomponent_getActive(cheatcomponent)
 
 
 
 
 
cheatcomponent_setDescription(cheatcomponent, string)
 
 
 
 
 
cheatcomponent_getDescription(cheatcomponent)
 
 
 
 
 
cheatcomponent_setHotkey(cheatcomponent, string)
 
 
 
 
 
cheatcomponent_getHotkey(cheatcomponent)
 
 
 
 
 
cheatcomponent_setDescriptionLeft(cheatcomponent, integer)
 
 
 
 
 
cheatcomponent_getDescriptionLeft(cheatcomponent)
 
 
 
 
 
cheatcomponent_setHotkeyLeft(cheatcomponent, integer)
 
 
 
 
 
cheatcomponent_getHotkeyLeft(cheatcomponent)
 
 
 
 
 
cheatcomponent_getEditValue(cheatcomponent) 
 
Returns the text from the editbox of this component
 
 
 
 
 
cheatcomponent_setEditValue(cheatcomponent, value)
 
Sets the text on an editbox
 
 
 
 
 
 
 
 
 
MemoryRecordHotkey Class (Inheritance object)
 
The memoryRecordHotkey class object is part of a MemoryRecord class. It's used as an interface to each individual hotkey inside a Cheat Table
 
 
 
 
 
memoryrecordhotkey_getDescription(hotkey)
 
 
 
 
 
memoryrecordhotkey_getHotkeyString(hotkey)
 
 
 
 
 
memoryrecordhotkey_getID(hotkey)
 
Returns the unique ID of this hotkey (Each hotkey inside a cheat entry has an unique id)
 
 
 
 
 
memoryrecordhotkey_getOwner(hotkey)
 
Returns the MemoryRecord this hotkey belongs to
 
 
 
 
 
memoryrecordhotkey_doHotkey(hotkey)
 
Executes the hotkey as if it got triggered by the keyboard
 
 
 
 
 
memoryrecordhotkey_onHotkey(hotkey, hotkeyfunction)
 
Registers a function to be called when the hotkey is pressed
 
  function (memoryrecordhotkey)
 
 
 
 
 
memoryrecordhotkey_onPostHotkey(hotkey, hotkeyfunction)
 
Registers a function to be called after the hotkey has been dealt with
 
  function (hotkey)
 
 
 
 
 
 
 
 
 
 
 
 
 
MemoryRecord Class
 
The Memoryrecord class object describes a Cheat Table's Cheat Entry.
 
 
 
 
 
memoryrecord_getID(memoryrecord)
 
Returns the unique id of this memory record. Every memory record has an unique id
 
 
 
 
 
memoryrecord_getHotkeyCount(memoryrecord)
 
Returns the number of hotkeys assigned to this Cheat Entry
 
 
 
 
 
memoryrecord_getHotkey(memoryrecord, index)
 
Returns a memoryrecordhotkey class
 
 
 
 
 
memoryrecord_getHotkeyByID(memoryrecord, ID)
 
Every hotkey in a memoryrecord gets an unique ID. This way you can always find the hotkey even if the order of hotkeys has changed (or deleted)
 
 
 
 
 
memoryrecord_setDescription(memoryrecord, description)
 
Sets the specified description for this entry
 
 
 
 
 
memoryrecord_getDescription(memoryrecord)
 
Gets the current description of this entry
 
 
 
 
 
memoryrecord_getAddress(memoryrecord)  
 
Returns the address and optional offsets for a pointer (note that in 64-bit kernelmode addresses will be rounded down...)
 
 
 
 
 
memoryrecord_setAddress(memoryrecord,address,offsets OPTIONAL) 
 
Sets the address of a entry. You can give as many offsets as you need
 
 
 
 
 
memoryrecord_getType(memoryrecord) 
 
Returns the Variable type. (vtByte to vtCustom)
 
 
 
 
 
memoryrecord_setType(memoryrecord, vartype) 
 
Sets the type of the entry
 
 
 
 
 
memoryrecord_getValue(memoryrecord)
 
Returns the current value of the cheat table entry as a string
 
 
 
 
 
memoryrecord_setValue(memoryrecord, value)
 
Sets the value of a cheat table entry
 
 
 
 
 
memoryrecord_getScript(memoryrecord) 
 
If the entry is of type vtAutoAssembler then you can get the script with this routine
 
 
 
 
 
memoryrecord_setScript(memoryrecord, script)
 
 
 
 
 
memoryrecord_isActive(memoryrecord)
 
 
 
 
 
memoryrecord_freeze(memoryrecord, updownfreeze OPTIONAL)
 
Sets the entry to frozen state. updownfreeze is optional. 0=freeze, 1=allow increase, 2=allow decrease
 
 
 
 
 
memoryrecord_unfreeze(memoryrecord)
 
Unfreezes an entry
 
 
 
 
 
memoryrecord_setColor(memoryrecord, colorrgb)
 
Sets the color of the entry
 
 
 
 
 
memoryrecord_appendToEntry(memoryrecord,memoryrecord) 
 
Adds the entry to another entry
 
 
 
 
 
memoryrecord_delete(memoryrecord)
 
It's unknown what this function does, all that is known is that after using this command other memrec routines with this table entry value don't work anymore...
 
 
 
 
 
memoryrecord_onActivate(memoryrecord, function)
 
Registers a function to be called when a cheat entry is Activated
 
  function (memoryrecord, before, currentstate) boolean
 
  If before is true returning false will cause the activation to stop
 
 
 
 
 
memoryrecord_onDeactivate(memoryrecord, function)
 
Registers a function to be called when a cheat entry is Deactivated
 
  function (memoryrecord, before, currentstate) boolean
 
  If before is true returning false will cause the deactivation to stop
 
 
 
 
 
memoryrecord_onDestroy(memoryrecord, function)
 
Registers a function to be called when a cheat entry is delete
 
  function (memoryrecord)
 
 
 
 
 
 
 
 
 
Addresslist Class
 
The addresslist class is a container for memory records
 
 
 
 
 
addresslist_getCount(addresslist)
 
 
 
 
 
addresslist_getMemoryRecord(addresslist, index)
 
 
 
 
 
addresslist_getMemoryRecordByDescription(addresslist, description)
 
 
 
 
 
addresslist_getMemoryRecordByID(addresslist, ID)
 
 
 
 
 
addresslist_createMemoryRecord(addresslist) 
 
creates a generic cheat table entry and adds it to the list. Returns a tableentry pointer you can use with memoryrecord routines
 
 
 
 
 
 
 
 
 
 
 
 
 
Memoryview Cass (Inheritance Form->ScrollingWinControl->CustomControl->WinControl->Control->Component->Object)
 
The memoryview class is the Memory view window of Cheat Engine. Use this as a basis to access the objects inside this window
 
 
 
 
 
memoryview_getDisassemblerView(memoryView)
 
Returns the visual disassembler object on the memoryview window
 
 
 
 
 
memoryview_getHexadecimalView(memoryView)
 
Returns the visual hexadecimal object on the memoryview window
 
 
 
 
 
 
 
 
 
Disassemblerview class (Inheritance Panel->CustomControl->WinControl->Control->Component->Object)
 
The visual disassembler used in the memory view window
 
 
 
 
 
disassemblerview_getSelectedAddress(disassemblerview)
 
 
 
 
 
disassemblerview_setSelectedAddress(disassemblerview, address)
 
 
 
 
 
disassemblerview_onSelectionChange(disassemblerview, function)
 
Registers a function to be called when the selection changes
 
  function(disassemblerview, address, address2)
 
 
 
 
 
Hexadecimal class (Inheritance Panel->CustomControl->WinControl->Control->Component->Object)
 
The visual hexadecimal object used on the memory view window
 
 
 
 
 
hexadecimalview_getTopAddress(hexadecimalview)
 
 
 
 
 
hexadecimalview_setTopAddress(hexadecimalview, address)
 
 
 
 
 
hexadecimalview_onAddressChange(hexadecimalview, function)
 
Registers a function to be called when the address is changed
 
  function(hexadecimalview, address)
 
 
 
 
 
hexadecimalview_onByteSelect(hexadecimalview, function)
 
Registers a function to be called when the selection changes
 
  function(hexadecimalview, address, address2)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Memory Scanning classes and routines
 
 
 
 
 
AOBScan(x,x,x,x,...)
 
Scans the currently opened process and returns a StringList object containing all the results. Don't forget to free this list when done else you will create a memory leak.
 
 
 
 
 
Bytevalue of higher than 255 or anything not an integer will be seen as a wildcard
 
 
 
 
 
 
 
 
 
AOBScan("aobstring", protectionflags OPTIONAL, alignmenttype OPTIONAL, alignmentparam HALFOPTIONAL)
 
protectionflags is a string.
 
  X=Executable W=Writable memory C=Copy On Write. Add a + to indicate that flag MUST be set and a - to indicate that that flag MUST NOT be set. (* sets it to don't care)
 
  Examples
 
    +W-C = Writable memory exluding copy on write and doesn't care about the Executable flag
 
    +X-C-W = Find readonly executable memory
 
    +W = Finds all writable memory and don't care about copy on write or execute
 
    "" = Find everything (is the same as "*X*C*W" )
 
 
 
 
 
 
 
 
 
alignmenttype is an integer
 
  0=No alignment check
 
  1=Address must be dividable by alignmentparam
 
  2=Address must end with alignmentparam
 
alignmentparam is a string which either holds the value the addresses must be dividable by or what the last digits of the address must be
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
MemScan Class (Inheritance Object)
 
The memscan class is the memory scanner of Cheat engine
 
 
 
 
 
createMemScan(progressbar OPTIONAL) 
 
Returns a new MemScan class object
 
 
 
 
 
getCurrentMemscan() 
 
Returns the current memory scan object. If tabs are used the current tab's memscan object
 
 
 
 
 
memscan_firstScan(memscan, scanoption, vartype, roundingtype, input1, input2 ,startAddress ,stopAddress ,protectionflags ,alignmenttype ,"alignmentparam" ,isHexadecimalInput ,isNotABinaryString, isunicodescan, iscasesensitive);
 
  Does an initial scan.
 
  memscan The MemScan object created with createMemScan
 
  scanOption : Defines what type of scan is done. Valid values for firstscan are
 
    soUnknownValue= Unknown initial value scan
 
    soExactValue= Exact Value scan
 
    soValueBetween= Value between scan
 
    soBiggerThan= Bigger than ... scan
 
    soSmallerThan= smaller than ... scan
 
 
 
 
 
  vartype Defines the variable type. Valid variable types are
 
    vtByte
 
    vtWord  (2 bytes)
 
    vtDword (4 bytes)
 
    vtQword (8 bytes)
 
    vtSingle (float)
 
    vtDouble
 
    vtString
 
    vtByteArray
 
    vtBinary
 
    vtAll
 
 
 
 
 
  roundingtype: Defines the way scans for exact value floating points are handled
 
    rtRounded:  Normal rounded scans. If exact value = "3" then it includes 3.0 to 3.49999999. If exact value is "3.0" it includes 3.00 to 3.0499999999
 
    rtTruncated: Truncated algoritm. If exact value = "3" then it includes 3.0 to 3.99999999. If exact value is "3.0" it includes 3.00 to 3.099999999
 
    rtExtremerounded: Rounded Extreme. If exact value = "3" then it includes 2.0000001 to 3.99999999. If exact value is "3.0" it includes 2.900000001 to 3.099999999
 
 
 
 
 
  input1: If required by the scanoption this is a string of the given variable type
 
  input2: If requires by the scanoption this is the secondary input
 
 
 
 
 
  startAddress:  The start address to scan from. You want to set this to 0
 
  stopAddress:  The address the scan should stop at. (You want to set this to 0xffffffffffffffff)
 
 
 
 
 
  protectionflags:  See aobscan about protectionflags
 
  alignmenttype:  Scan alignment type. Valid options are
 
    fsmNotAligned=  No alignment check
 
    fsmAligned    =The address must be dividable by the value in alignmentparam
 
    fsmLastDigits =  The last digits of the address must end with the digits provided by alignmentparam
 
 
 
 
 
  alignmentparam:  String that holds the alignment parameter.
 
 
  isHexadecimalInput: When true this will handle the input field as a hexadecimal string else decimal
 
  isNotABinaryString: When true and the varType is vtBinary this will handle the input field as a decimal instead of a binary string
 
  isunicodescan: When true and the vartype is vtString this will do a unicode (utf16) string scan else normal utf8 string
 
  iscasesensitive:  When true and the vartype is vtString this check if the case matches
 
 
 
 
 
   
 
 
 
 
 
 
 
 
 
memscan_nextScan(memscan, scanoption, roundingtype, input1,input2, isHexadecimalInput, isNotABinaryString, isunicodescan, iscasesensitive, ispercentagescan, savedresultname OPTIONAL);
 
Does a next scan based on the current addresslist and values of the previous scan or values of a saved scan
 
  memscan: The MemScan object that has previously done a first scan
 
  scanoption
 
    soExactValue= Exact Value scan
 
    soValueBetween= Value between scan
 
    soBiggerThan= Bigger than ... scan
 
    soSmallerThan= smaller than ... scan
 
    soIncreasedValue= Increased value scan
 
    soIncreasedValueBy= Increased value by scan
 
    soDecreasedValue= Decreased value scan
 
    soDecreasedValueBy= Decreased value by scan
 
    soChanged= Changed value scan
 
    soUnchanged =Unchanged value scan
 
 
 
  roundingtype: Defined the way scans for exact value floating points are handled
 
    rtRounded = Normal rounded scans. If exact value = "3" then it includes 3.0 to 3.49999999. If exact value is "3.0" it includes 3.00 to 3.0499999999
 
    rtTruncated =Truncated algoritm. If exact value = "3" then it includes 3.0 to 3.99999999. If exact value is "3.0" it includes 3.00 to 3.099999999
 
    rtExtremerounded= Rounded Extreme. If exact value = "3" then it includes 2.0000001 to 3.99999999. If exact value is "3.0" it includes 2.900000001 to 3.099999999
 
 
 
  input1: If required by the scanoption this is a string of the given variable type
 
  input2: If requires by the scanoption this is the secondary input
 
 
 
 
 
  isHexadecimalInput :When true this will handle the input field as a hexadecimal string else decimal
 
  isNotABinaryString: When true and the varType is vtBinary this will handle the input field as a decimal instead of a binary string
 
  isunicodescan: When true and the vartype is vtString this will do a unicode (utf16) string scan else normal utf8 string
 
  iscasesensitive:  When true and the vartype is vtString this check if the case matches
 
  ispercentage: When true and the scanoption is of type soValueBetween, soIncreasedValueBy or soDecreasedValueBy: will cause CE to do a precentage scan instead of a normal value scan
 
  savedResultName: String that holds the name of a saved result list that should be compared against. First scan is called "FIRST"
 
 
 
 
 
 
 
 
 
memscan_newscan(memscan) 
 
Clears the current results
 
 
 
 
 
memscan_waitTillDone(memscan)
 
 
 
 
 
memscan_saveCurrentResults(memscan, name)
 
 
 
 
 
memscan_getAttachedFoundlist(memscan) 
 
Returns a FoundList object if one is attached to this scanresults. Returns nil otherwise
 
 
 
 
 
FoundList
 
The foundlist is an object that opens the current memscan's result file and provides an interface for reading out the addresses
 
 
 
 
 
createFoundList(memscan)
 
foundlist_initialize(foundlist)
 
foundlist_deinitialize(foundlist)
 
foundlist_getCount(foundlist)
 
foundlist_getAddress(foundlist, index) 
 
Returns the address as a string
 
 
 
 
 
foundlist_getValue(foundlist, index)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Undefined Property Functions
 
Not all properties of all classes have been explicitly exposed to lua, but if you know the name of a property of a specific class you can still access them (assuming they are declared as published in the pascal class declaration)
 
getPropertyList(class) 
 
Returns a StringList object containing all the published properties of the specified class (free the list when done) (Note, not all classed with properties have 'published' properties. E.g StringList itself)
 
 
 
 
 
setProperty(class, propertyname, propertyvalue)  Sets the value of a published property of a class (Won't work for method properties)
 
getProperty(class, propertyname)  Gets the value of a published property of a class (Won't work for method properties)
 

Latest revision as of 19:35, 25 June 2026

⚠️ Work Needed

This page still needs significant improvements.

Please help by expanding or correcting this article where possible.

For suggestions or discussion, see the talk page.

Cheat Engine Lua API Index
A task-oriented reference index for Cheat Engine's Lua functions, classes, globals, and scripting helpers.

Cheat Engine exposes an extensive Lua API for cheat tables, trainers, and standalone scripts. This page is a task-oriented index: choose the area you are working in, then follow a function link for its detailed reference.

Contents

Variables[edit]

Globals[edit]

Global Variables

Name
Type
Description
string
Path of the trainer that launched Cheat Engine. Only set when Cheat Engine was launched as a trainer.
string
Main module name of the currently opened process (e.g. mygame.exe or module name).
object
The main Cheat Engine GUI form object.
object
The address list object of the main Cheat Engine GUI (cheat table address list).

CPU / Debug Variables (Registers)[edit]

CPU / Debug Variables

Register / Variable
Architecture
Description
EFLAGS
32/64-bit
CPU flags register value available in the debug context.
EAX, EBX, ECX, EDX, EDI, ESI, EBP, ESP, EIP
32/64-bit
Standard 32-bit register values (present when debugging 32-bit contexts or in compatible views).
RAX, RBX, RCX, RDX, RDI, RSI, RBP, RSP, RIP, R8, R9, R10, R11, R12, R13, R14, R15
64-bit only
64-bit register values available in 64-bit debug contexts.

Functions[edit]

Function names follow consistent patterns: create... creates an object or window, get... retrieves data, set... changes a setting, read.../write... transfer data, and register.../unregister... manage callbacks. Related functions are kept together where possible.

Quick navigation[edit]

Quick Navigation

What do you want to do?
Recommended sections
Manage a table or build a trainer
Find, read, write, or convert memory
Work with a process, threads, windows, or handles
Automate Cheat Engine or generate code
Build forms, controls, or visual tools
Debug, use the driver, or access DBVM
Find less common CE 7.5 APIs
Extended API reference — pipes, SQL, .NET, XML, CEServer, and additional factories

Function naming guide[edit]

Function Naming Guide

Prefix / pattern
Meaning
create...
Creates an object, control, stream, worker, or other resource. Check the returned class before using it.
get..., enum...
Retrieves one value/object or enumerates a collection, usually without changing state.
set..., enable...
Changes a setting, protection, or runtime state.
read..., write...
Transfers data. Unless the name ends in Local, memory functions normally operate on the opened target process.
register..., unregister...
Adds or removes a callback, handler, hook, or extension. Keep the returned ID when an unregister function requires it.

Cheat Table[edit]

These functions help manage the cheat table and its files.

Cheat Table

Function
Description

Returns the cheat table Addresslist object.

Returns a TableFile stored in the cheat table (search by filename or identifier).

Adds a new file entry to the cheat table.

Loads a ".ct" or ".cetrainer" file or stream into the cheat table.

Saves the current cheat table to disk.

Trainers[edit]

Functions related to the trainer (.exe) generator.

Trainers

Function
Description

Adds a new feature to the EXE trainer generator window and calls your callback when a user builds a .exe trainer.

Unregisters a previously registered trainer feature.

Protection[edit]

Functions for protecting Cheat Engine or encoding code.

Protection

Function
Description

Prevents basic memory scanners from opening or inspecting the Cheat Engine process.

Enables kernel-mode protections or DRM measures to prevent normal memory scanners from reading the Cheat Engine process.

Encodes a given Lua function to a string that can be stored/transferred; can be decoded later with decodeFunction.

Decodes an encoded function string back into a callable Lua function.

Scanning[edit]

Functions that control and query memory scans.

Scanning

Function
Description

Scans the currently opened process for an array-of-bytes (AOB) pattern and returns a StringList of all matches.

Scans the process memory for a byte pattern and returns the address if exactly one unique match is found; returns nil otherwise.

Scans the entire process for a pattern and returns the address if exactly one unique match exists; returns nil otherwise.

Returns the currently active scan session as a MemScan object.

Process[edit]

Functions for creating/opening processes and querying system/process state.

Process

Function
Description

Creates (and optionally debugs) a new process.

Opens a process given a process name or PID; attaches Cheat Engine to it for memory access.

Callback invoked by Cheat Engine when it opens a process (user-defined handler).

Returns the process ID (PID) of the currently foreground (top) window process.

Returns the PID of the currently opened/attached process.

Returns the PID for a given process name (if running).

Opens a file and treats it like a process (gives memory access similar to opening a process).

Saves changes made to the opened file.

Sets the pointer size (in bytes) Cheat Engine will use (e.g. 4 or 8); useful if a 64-bit process requires 32-bit pointer handling.

Sets assembler bit mode: 0 = 32-bit, 1 = 64-bit.

Returns a system process list object.

Returns a list of top-level windows.

Pauses the currently opened process.

Resumes the currently opened process.

Returns true if the target process is 64-bit, otherwise false.

Returns a table with information about each module in the current process (or a specified PID).

Returns a table containing the memory layout with information about each memory region.

Closes a remote handle to a process.

Threads[edit]

Threads

Function
Description

Returns the number of CPU cores available on the system.

Fills a List object with the thread list of the currently opened process (returns thread IDs and basic info).

Returns true if the current Lua code is running in the main thread (available in CE 6.4+); otherwise false.

Executes the provided function in the main thread and returns that function's return value. Useful for GUI updates or operations that must run on the main thread.

Schedules the provided function to run in the main thread but does not wait for the result (fire-and-forget).

Intended to be called from the main thread's loop to process pending synchronized calls when using threads and synchronize/queue.

Handles[edit]

Handles

Function
Description

Returns a table (or list object) containing system handles (open handles) for the system or the current process, depending on context.

Addresses[edit]

These functions help convert between memory addresses and symbol/CE address string representations.

Addresses

Function
Description

Returns the numeric address of a symbol (module+export, label, or CE symbol). Raises an error if the symbol cannot be resolved.

Same as getAddress but returns nil if the symbol cannot be found (does not throw).

Returns the address formatted as a string, preferring symbol/module+offset notation when available.

Assigns the specified symbol name to an address (adds a user-defined symbol).

Removes a previously registered symbol mapping for an address.

Returns a table/object with symbol information (module name, search key, address, size), matching the SymbolList structure.

Reinitializes the symbol handler (useful after loading new modules).

Returns true if the specified address lies inside a loaded module.

Returns true if the address is inside a system module (OS module), e.g., kernel or system DLLs.

Returns the size (in bytes) of the specified module. Use getAddress to retrieve the module base address first if needed.

Sets whether address/symbol lookups will throw errors on failure or return 0/nil depending on configuration.

Registers a callback function invoked when a symbol is parsed/loaded.

Unregisters a previously registered symbol lookup callback.

Registers a callback called when an address-to-name conversion is requested.

Unregisters the address lookup callback.

Reinitializes only the .NET portion of the symbol handler (useful when .NET modules change).

Memory[edit]

Memory

Function
Description

Allocates executable/non-executable memory in the target process and returns the allocated address.

Frees memory previously allocated in the target process.

Creates or opens a named shared memory object of the given size for interprocess communication.

Creates a memory section object (OS-specific) for sharing or mapping memory.

Maps a created section into the process address space, returning the mapped base address.

Unmaps a previously mapped section view from the process address space.

Copies memory from a source address to a destination address (can be used within target process or between processes depending on API).

Compares two memory regions (can be used within target process or between processes depending on API).

Allocates a block of nonpaged kernel memory (requires driver or appropriate privileges) and returns its address.

Frees kernel-mode memory previously allocated.

Maps memory from one process context into another usermode context (maps a specified address from PID A into PID B's address space).

Unmaps memory previously mapped with mapMemory.

Creates a memory stream object that can be used to read/write memory data conveniently from Lua.

Reading from Target Process[edit]

Reading from Target Process

Function
Description

Reads raw bytes at the given address. If ReturnAsTable is true, returns a table; otherwise returns multiple byte values.

Reads a 16-bit (word) integer from the specified address. Optional second parameter: if true, reads as signed integer.

Reads a 32-bit (dword) integer from the specified address. Optional second parameter: if true, reads as signed integer.

Reads a 64-bit (qword) integer from the specified address.

Reads a pointer-sized value: readQword on 64-bit targets, readInteger on 32-bit targets.

Reads a single-precision (32-bit) floating-point value from the specified address.

Reads a double-precision (64-bit) floating-point value from the specified address.

Reads a null-terminated string from memory up to maxlength bytes (prevents infinite loops on corrupted memory).

Reads a region from a file and writes it to a specific address in the target process.

Reading from Cheat Engine Memory[edit]

Reading from Cheat Engine Memory

Function
Description

Same as readBytes, but reads from Cheat Engine's own memory.

Reads a 16-bit integer from CE's memory. Optional: use signed if second parameter is true.

Reads a 32-bit integer from CE's memory. Optional: use signed if second parameter is true.

Reads a 64-bit integer from CE's memory.

Reads a pointer-sized value from CE's memory (64-bit or 32-bit depending on CE build).

Reads a single-precision float from CE's memory.

Reads a double-precision float from CE's memory.

Reads a null-terminated string from CE's memory.

Writing to Target Process[edit]

Writing to Target Process

Function
Description

Writes the given bytes (from a table) to the specified address in the target process.

Writes a 16-bit integer to the specified address. Returns true on success.

Writes a 32-bit integer to the specified address. Returns true on success.

Writes a 64-bit integer to the specified address. Returns true on success.

Writes a single-precision float to the specified address. Returns true on success.

Writes a double-precision float to the specified address. Returns true on success.

Writes a string to the specified address (typically null-terminated). Returns true on success.

Writes a memory region to a file. Returns the number of bytes written.

Writing to Cheat Engine Memory[edit]

Writing to Cheat Engine Memory

Function
Description

Writes a 16-bit integer to CE's memory. Returns true on success.

Writes a 32-bit integer to CE's memory. Returns true on success.

Writes a 64-bit integer to CE's memory. Returns true on success.

Writes a single-precision float to CE's memory. Returns true on success.

Writes a double-precision float to CE's memory. Returns true on success.

Writes a string to CE's memory. Returns true on success.

Writes the given bytes (from a table) to CE's memory.

Conversions[edit]

Encoding/Decoding[edit]

Encoding/Decoding

Function
Description

Converts a string from ANSI encoding to UTF-8 encoding.

Converts a string from UTF-8 encoding to ANSI encoding.

Computes and returns the MD5 hash of a string as a hexadecimal string.

Converts a given integer to a userdata variable.

Converts a given userdata variable back to an integer.

To Byte Table[edit]

Convert data types into byte tables (tables of individual byte values).

To Byte Table

Function
Description

Converts a 16-bit word to a byte table.

Converts a 32-bit dword to a byte table.

Converts a 64-bit qword to a byte table.

Converts a single-precision float to a byte table.

Converts a double-precision float to a byte table.

Converts a string (ANSI/UTF-8) to a byte table.

Converts a string to a wide string (Unicode) and then to a byte table.

From Byte Table[edit]

Convert byte tables back into data types.

From Byte Table

Function
Description

Converts a byte table to a 16-bit word.

Converts a byte table to a 32-bit dword.

Converts a byte table to a 64-bit qword.

Converts a byte table to a single-precision float.

Converts a byte table to a double-precision float.

Converts a byte table to a string.

Converts a byte table to a wide string (Unicode).

Binary Operations[edit]

Bitwise operations on integers.

Binary Operations

Function
Description

bOr

Bitwise OR operation.

Bitwise XOR (exclusive OR) operation.

Bitwise AND operation.

Bitwise shift left operation.

Bitwise shift right operation.

Bitwise NOT (complement) operation.

Input Devices[edit]

Keyboard & Mouse[edit]

Keyboard & Mouse

Function
Description

Returns the current mouse cursor position as X and Y coordinates.

Sets the mouse cursor position to the specified X and Y coordinates.

Returns true if the specified key is currently held down.

Simulates pressing a key (puts the key into down state).

Simulates releasing a key (puts the key into up state).

Simulates a complete key press (down and up).

Calls the Windows API mouse_event directly for advanced mouse control. See MSDN documentation.

Sets the global key poll interval (frequency of keyboard state updates).

Sets the minimum delay (in milliseconds) between consecutive activations of the same hotkey.

Game Controller[edit]

XBox/game controller input.

Game Controller

Function
Description

Fetches the current state (buttons, triggers, sticks) of a connected XBox 360 controller.

Sets the speed of the left and right vibration motors in an XBox 360 controller (for haptic feedback).

Clipboard[edit]

Clipboard

Function
Description

Writes the given text to the system clipboard.

Screen[edit]

Screen

Function
Description

Returns the height of the screen in pixels.

Returns the width of the screen in pixels.

Returns the screen DPI (dots per inch) for determining screen scaling/density.

Returns the height of the usable work area (excludes taskbars).

Returns the width of the usable work area (excludes taskbars).

Returns a Canvas object for drawing directly to the screen. Limited usefulness in practice due to performance constraints.

Returns the RGB color value of a pixel at the specified screen coordinates.

Sounds[edit]

General Audio[edit]

General Audio

Function
Description

Plays an audio file (supports various formats like .wav, .mp3, etc.).

Plays a system beep/ping sound.

Text-to-Speech[edit]

Text-to-Speech

Function
Description

Speaks the given text using the system's text-to-speech engine and optional flags. See MSDN SpeakFlags.

Speaks the given text using an English voice by wrapping it in an XML voice specification.

XM Player[edit]

Plays tracked music (XM format) using the built-in XM player.

XM Player

Function
Description

Plays an XM audio file given its filename.

Pauses the currently playing XM audio file.

Resumes playback of a paused XM audio file.

Stops XM audio playback completely.

Returns true if an XM audio file is currently being played.

Fonts[edit]

Fonts

Function
Description

Loads a font from a memory stream and returns a handle/ID for later use with unloadLoadedFont.

Unloads a previously loaded font by its handle/ID, freeing resources.

Forms and Windows[edit]

Forms and Windows

Function
Description

Finds a window by class name and/or window title/caption.

Gets a window handle based on a relative command (e.g. parent, child, next). See MSDN GetWindow.

Returns the caption/title text of the specified window.

Returns the class name of the specified window.

Returns the process ID (PID) of the process that owns the specified window.

Returns the handle of the topmost (foreground) window currently active.

Sends a Windows message to the specified window.

Hooks a window's window procedure (WndProc) to intercept and handle messages.

Uninstalls a WndProc hook previously installed via hookWndProc.

Cheat Engine[edit]

Functions for managing and controlling Cheat Engine itself.

Version and Information[edit]

Version and Information

Function
Description

Returns the Cheat Engine version as a floating-point number (e.g. 7.5).

Returns full version information: a raw integer and a table containing major, minor, release, and build numbers.

Returns true if Cheat Engine is running as 64-bit; false if 32-bit.

Returns the process ID of the Cheat Engine process itself.

Returns the folder path where Cheat Engine (or the current trainer) is located.

Management[edit]

Management

Function
Description

Closes Cheat Engine.

Returns the Timer object responsible for freezing/unfreezing values in the address list.

Returns the Timer object responsible for updating displayed values in the address list.

Returns the common module list as a StringList object.

Returns the AutoAttach list as a StringList object.

Connects to a remote Cheat Engine server (given host and port). Subsequent operations route through the server.

Reloads Cheat Engine settings from the registry and applies them immediately.

Loads the specified plugin.

Returns the settings object for accessing/modifying CE configuration.

Registers a binutils (assembler/disassembler) toolset with Cheat Engine.

Comments and Headers[edit]

Comments and Headers

Function
Description

Gets the user-defined comment attached to the specified address.

Sets a user-defined comment at the specified address.

Gets the user-defined header text at the specified address.

Sets a user-defined header text at the specified address.

Advertising and Support[edit]

Advertising and Support

Function
Description

Displays an advertising/support window to help fund Cheat Engine development.

Hides/closes the advertising window if it was showing (crude but functional name).

Forms and UI[edit]

Forms and UI

Function
Description

Returns the total number of forms currently attached to the main CE application.

Returns the form object at the specified index (0-based).

Returns the first MemoryView form object (the hex editor window).

Returns the main Cheat Engine window form object.

Returns the settings/options dialog form object.

Returns the Lua engine/console form object (creates it if needed).

Shows the main Cheat Engine window (opposite of hideAllCEWindows).

Hides all normal Cheat Engine windows (e.g. the trainer table UI).

Registers a callback function invoked when a form is added to CE's form list.

Unregisters a previously registered form add notification callback.

Messages[edit]

Messages

Function
Description

Shows a simple message box with the given text to the user.

Pops up a message dialog box (similar to showMessage, with more control over buttons/options).

Outputs a message using the Windows OutputDebugString API (visible in debuggers).

Processes pending window messages in the event queue, allowing button clicks and UI updates to be handled.

Input[edit]

Input

Function
Description

Shows a dialog prompting the user to input a string. Returns the entered string, or nil if cancelled (CE 6.4+).

Shortcuts[edit]

Shortcuts

Function
Description

Converts a shortcut integer value to its textual representation (e.g. "Ctrl+Alt+A"). (CE 6.4+)

Converts a text representation (e.g. "Ctrl+Alt+A") to a shortcut integer value. (CE 6.4+)

Converts a key combination to its string representation, matching the hotkey handler's format.

Speed Hack[edit]

Speed Hack

Function
Description

Enables the speed hack (if not already active) and sets the game/process speed multiplier (e.g. 2.0 for 2x speed).

Returns the current speed hack multiplier value that was last set.

Lua[edit]

Functions for managing the Lua engine and state.

Lua

Function
Description

Creates a fresh Lua state, resetting the environment and clearing all previously defined variables/functions.

Pauses execution for the specified number of milliseconds.

Creates and returns an integer reference handle that can store and retrieve Lua objects persistently.

Retrieves the Lua value/object referenced by the given reference handle.

Destroys and frees a reference handle, removing the reference and allowing garbage collection.

Types[edit]

Functions for registering and managing custom data types.

Types

Function
Description

Registers a callback function invoked by Cheat Engine's auto-guess feature to predict and suggest variable types.

Registers a custom data type defined using Lua functions for reading/writing/display logic.

Registers a custom data type defined using an Auto Assembler script.

Object-oriented[edit]

Functions for determining class inheritance and type relationships.

Object-oriented

Function
Description

Returns true if the given object is a valid Cheat Engine class instance (inherits from Object).

Returns true if the given object inherits from the Component class.

Returns true if the given object inherits from the Control class (UI controls).

Returns true if the given object inherits from the WinControl class (windowed controls).

Assembly[edit]

Functions for working with x86/x64 machine code and assembly instructions.

Assembly

Function
Description

Executes an Auto Assembler script (given as text) for code injection, patching, or other assembly operations.

Validates an Auto Assembler script for syntax errors. Returns true on success; false with error message on failure.

Disassembles the instruction at the given address and returns a formatted string: "address - bytes - opcode extra".

Parses a disassembled instruction string and returns 4 separate strings: address, bytes, opcode, and extra field.

Returns the size (in bytes) of the instruction at the given address.

Attempts to find and return the address of the previous instruction (heuristic guess).

Registers a custom callback function for the single-line assembler to convert instruction mnemonics to bytes.

Unregisters a previously registered custom assembler callback.

Auto Assembler[edit]

Commands & Hooks[edit]

Commands & Hooks

Function
Description

Registers a custom Auto Assembler command that calls the specified Lua function when invoked in a script.

Unregisters a previously registered Auto Assembler command.

Registers a callback function invoked before the Auto Assembler parses a script (prologue phase).

Unregisters an Auto Assembler prologue callback.

Changes memory protection on a block of memory to be writable and executable.

Scripts & Templates[edit]

Scripts & Templates

Function
Description

Registers a reusable template for the Auto Assembler script generator.

Unregisters a previously registered Auto Assembler template.

Generates and appends a default code injection script to the provided script (allocates space, injects code, patches original).

Generates and appends an Array-of-Bytes (AOB) injection script to the provided script (searches for pattern, injects code).

Generates and appends a complete full injection script with all patches and cleanup code.

Generates an Auto Assembler script that hooks (intercepts) the given API function address.

Debugger[edit]

Functions for managing the debugger. See Lua Debugging for detailed information.

Status and Information[edit]

Status and Information

Function
Description

Returns true if the debugger has been started and is active.

Returns the current debugger interface type: 1=Windows, 2=VEH, 3=Kernel, nil=no debugging.

Returns true if the target process can stop on a breakpoint. (CE 6.4+)

Returns true if the debugger is currently halted on a thread (at a breakpoint).

Returns a Lua table containing all currently active breakpoint addresses.

Breakpoint Management[edit]

Breakpoint Management

Function
Description

Starts debugging the currently attached process.

Sets a breakpoint of a specific size (in bytes) at the given address.

Removes a breakpoint at the specified address.

Resumes execution when the debugger is halted on a breakpoint.

Adds a thread to the no-break list so breakpoints on it will be ignored.

Removes a thread from the no-break list.

Callbacks[edit]

Callbacks

Function
Description

User-defined callback invoked by CE when a breakpoint is hit (define your own implementation).

User-defined callback invoked by the Windows debugger when a module is loaded.

Register and Context Management[edit]

Register and Context Management

Function
Description

Force-updates the Lua variables representing CPU registers from the current thread context. (CE 6.5+)

Force-updates the CPU registers from the Lua variables representing them. (CE 6.5+)

Refreshes the UI to reflect the current debug context if the debugger is broken.

Returns the memory address of the specified XMM register for the currently broken thread.

Advanced Debugging[edit]

Advanced Debugging

Function
Description

Tells the kernel-mode debugger to record the last few branch/jump instructions before a breakpoint is hit.

Returns the maximum number of branch records this CPU supports.

Returns the Last Branch Record value at the given index (when handling a breakpoint with branch recording enabled).

Detaches the debugger from the target process if possible.

DBK (Driver-Based Kernel)[edit]

Functions for kernel-mode operations via the DBK driver.

Initialization and Setup[edit]

Initialization and Setup

Function
Description

Loads and initializes the DBK kernel driver into memory if possible.

Redirects OpenProcess API calls to use kernel-mode DBK equivalents.

Redirects ReadProcessMemory and WriteProcessMemory to use kernel-mode DBK versions.

Redirects virtual memory query APIs to use kernel-mode DBK equivalents.

Process and Thread Information[edit]

Process and Thread Information

Function
Description

Returns the kernel pointer to the EPROCESS structure of the selected process ID.

Returns the kernel pointer to the ETHREAD structure of a given thread ID.

CPU Register Access[edit]

CPU Register Access

Function
Description

Reads a Model-Specific Register (MSR) using the DBK driver.

Writes a Model-Specific Register (MSR) using the DBK driver.

Returns the value of Control Register 0 (CR0).

Returns the value of Control Register 3 (CR3) for the currently opened process.

Returns the value of Control Register 4 (CR4).

Memory and Execution[edit]

Memory and Execution

Function
Description

Converts a virtual address to its physical address using the DBK driver.

Executes a routine from kernel mode (e.g. injected code written with Auto Assembler).

When set to true, write operations bypass copy-on-write behavior.

DBVM[edit]

Functions for hypervisor-based operations and advanced memory monitoring via DBVM.

Initialization[edit]

Initialization

Function
Description

Initializes the DBVM hypervisor functions for use.

Memory Operations[edit]

Memory Operations

Function
Description

Adds a memory region to DBVM.

Reads physical memory directly using DBVM (hypervisor-level access).

Writes physical memory directly using DBVM (hypervisor-level access).

MSR and Control Register Access[edit]

MSR and Control Register Access

Function
Description

Reads a Model-Specific Register (MSR) using DBVM (bypasses driver).

Writes a Model-Specific Register (MSR) using DBVM (bypasses driver).

Returns the real (unhooked) value of Control Register 4 (CR4).

Memory Monitoring[edit]

Memory Monitoring

Function
Description

Starts monitoring write accesses to a memory region.

Starts monitoring read accesses to a memory region.

Retrieves the log/results of memory region monitoring (reads or writes).

Stops memory region monitoring.

Memory Cloaking[edit]

Memory Cloaking

Function
Description

Cloaks a memory page so modifications become invisible to the target process.

Disables cloaking on a page and undoes hidden modifications.

Reads the original (hidden) memory contents of a cloaked region.

Writes to the original (hidden) memory contents of a cloaked region.

Breakpoints and Debugging[edit]

Breakpoints and Debugging

Function
Description

Cloaks a page, sets a breakpoint at the given address, and modifies registers when the breakpoint is hit.

Removes a "change registers on breakpoint" breakpoint.

CR3 (Process Context) Logging[edit]

CR3 (Process Context) Logging

Function
Description

Starts logging all CR3 (process context/page directory) changes.

Stops CR3 logging.

Performance and Anti-Detection[edit]

Performance and Anti-Detection

Function
Description

Sets system-wide speed hack via DBVM (affects all processes).

Configures TSC (Time Stamp Counter) adjustment to bypass VM detection (RDTSC hooks).

Translation[edit]

Translation

Function
Description

Returns the path to the current translation files. Returns an empty string if no translation is active.

Loads a ".PO" translation file into Cheat Engine's translation system.

Returns the translated text for a given source string. If no translation is found, returns the original string.

Returns the translation for a specific string ID (lookup by numerical or symbolic ID).

Files[edit]

Files

Function
Description

Returns a 64-bit file version and a table splitting the version into major, minor, release, and build.

Returns an indexed table (array) of filenames in the specified directory.

Returns an indexed table (array) of subdirectory names in the specified directory.

Structures[edit]

Structures

Function
Description

Registers a callback similar to onAutoGuess that the structure dissect window calls when the user requests Cheat Engine to guess a structure layout.

Unregisters a previously registered structure dissect auto-guess override.

Registers a function that will be called when the structure dissect UI requests a name for a newly detected structure definition.

Unregisters a previously registered structure name lookup callback.

Miscellaneous[edit]

Miscellaneous

Function
Description

Injects a DLL into the currently opened process.

Executes a given command or opens a file/URL using the system shell.

Executes a stdcall function at a given address in the target process with one parameter and waits for it to return.

Extended version of executeCode (supports more parameters/options).

Executes a stdcall function at a given address in Cheat Engine's own process (local execution).

Extended version of executeCodeLocal with additional options.

Registers a callback invoked when an API pointer is changed (allows reacting to API remapping).

Sets the pointer/address used for a specified API function.

Computes and returns the MD5 checksum (hex string) of the bytes at the provided memory address/size.

Computes and returns the MD5 checksum (hex string) of a file's contents.

Retrieves the specified system metric or configuration setting. See: MSDN documentation.

Returns the tick count in milliseconds since the system started.

Reads an environment variable stored in the current user's registry environment.

Writes an environment variable to the current user's registry environment.

Broadcasts a notification that environment variables were changed (call after setting registry variables).

Returns the application object (main application/titlebar context).

Returns an Internet client class object. The provided string specifies the client name/type.

Signs a .CT-File given a valid and installed Cheat Engine Signature.


Extended API reference (CE 7.5)[edit]

This section covers additional global and factory APIs exposed by celua-75.lua. It is grouped by the task they support rather than by their implementation order. Class instance methods remain documented with their respective classes.

Core runtime, memory, and conversion helpers[edit]

Use these for runtime detection, memory-protection changes, byte/value conversion, and sharing simple values between Lua states.

Core runtime, memory, and conversion helpers

Function
Description

Returns 0 if CE is running in Windows, 1 for Mac

Returns true if CE is running in windows Dark Mode. Has no effect on mac

Sets the given protection on the address range. Note, some systems do not support X and W to be true at the same time

Alias for readShortInteger; reads an 8-bit integer from target-process memory.

Reads an 8-bit integer from target-process memory.

Alias for writeShortInteger; writes an 8-bit integer to target-process memory.

Writes an 8-bit integer to target-process memory.

Writes a pointer-sized integer to target-process memory.

Writes a pointer-sized integer to Cheat Engine memory.

Sign-extends a value using the specified most-significant bit.

Converts an Extended value to a byte table.

Converts a byte table to an Extended value (returned as a double).

Returns the given variable from the main lua state. Only basic types are supported. (Handy for new lua state threads)

Sets the global variable names string in the main lua state. Only basic types are supported

Encodes a Lua script, optionally using the specified Lua DLL.

Files, symbol loading, and native compilation[edit]

These APIs operate on paths, augment symbol information, or compile and assemble native and .NET code.

Files, symbol loading, and native compilation

Function
Description

returns the filename of the path

returns the file extension of the path

Returns the filename of the path, without the extension

removes the filename from the path

Returns the path to the temp folder

Returns true if a file exists at that path

Returns true if a file existed at that path, and now not anymore

Will download the PDB files of Windows and load them (Takes a long time the first time)

Will check the option for kernelmode symbols in memory view (Gets only the exports unless enableWindowsSymbols() is used)

Returns the classname of a given structure based on RTTI information (assuming it can be found, returns nil if not or unknown)

Reinitializes Cheat Engine's own symbol handler.

Waits till the sections have been enumerated

Waits till all DLL Exports are loaded

Waits till all .NET symbols are loaded (this includes DLL Exports)

Waits till all PDB symbols are loaded (this includes DLL Exports, and .NET)

Will interrupt symbol enum to query the debughelp symbol handler about a specific symbol. This can take a while. Default is false

Stops the symbolloader from processing any debug files and releases what it had open

If set to true looking up a symbol will wait for the symbol to be loaded(default true)

Assembles one instruction and returns its bytes.

Compiles C code and returns a table with the addresses of the symbols on success, or nil with a secondary result containing the errormessage

Compiles an indexed list of C source files.

Compiles the TCC library functions some C code may need to function internally

Adds an extra default include path for the compile() function

Removes a specific path previously added with addCIncludePath

Compiles c# code and returns the autogenerated filename. references is a list of c# assemblies this code may reference.

Calls a static .NET class method from Cheat Engine.

Auto Assembler authoring and callbacks[edit]

Use callback registrations to extend Auto Assembler parsing and structure dissection; keep any returned registration ID for cleanup.

Auto Assembler authoring and callbacks

Function
Description

Makes the lua highlighter show the functionname as a functionkeyword

Removes the given name from showing up as a functionkeyword

Registers a callback for global-structure-list updates.

Unregisters a global-structure-list update callback.

Registers a function to be called when a structure needs to be dissected

Unregisters the structure and element list callback.

Returns the next unused newmem allocation number in an Auto Assembler script.

Adds a snapshot of original code as a comment to an Auto Assembler script.

Finds a unique AOB pattern for an address and returns its offset.

Process control, code execution, and prompts[edit]

This group covers process handles, code invocation, clipboard access, GC control, and small user-facing dialogs.

Process control, code execution, and prompts

Function
Description

Shows a selection list and returns the selected index and text.

Duplicates the provided CE based handle into the target process (You still need tell the target about this handle, like an injected dll data block)

If defined this function will be called twice when a table gets loaded. Once before the loading, and once after.

Returns the handle of the currently opened process

Returns the size of the currently opened target executable.

Gets the current pointersize

Returns CPUID register values for the supplied EAX and ECX inputs.

Enables or disables the passive Lua garbage collector.

Configures the active Lua garbage collector.

Returns the inverted color

Executes the given command and returns the output of the command as a string and the exitcode as an integer (Should not open a console window) If pathtoexecutein is not provided the path...

Reads the text from the clipboard

Alias for injectDLL; injects a DLL or dylib into the target process.

Injects a .NET assembly and invokes its specified method.

Executes a method.

Target inspection, allocation, and task progress[edit]

These helpers inspect the target architecture, allocate memory in Cheat Engine, disassemble bytes, or update Windows taskbar progress.

Target inspection, allocation, and task progress

Function
Description

Allocates named shared memory in the Cheat Engine process.

Returns true if the target process is x86 based

Returns true if the target process is arm based

Returns true if the target process is running on the Android OS

Returns the autorun path

Disassembles the given bytes and returns the result.

Same as print(string.format(...))

Sets the state of the cheatengine task in the taskbar (windows only) values: tbpsNone, tbpsIndeterminate, tbpsNormal, tbpsError, tbpsPaused

Sets the state of the cheatengine task progress status

Registered symbols[edit]

Use these only for symbols registered through Lua or Auto Assembler; they do not enumerate every symbol known to the symbol handler.

Registered symbols

Function
Description

Returns a table with elements containing {symbolname, address, OPTIONAL {allocsize, processid, donotsave

Deletes all symbols registered with registerSymbols, both in AA and Lua scripts (Does not remove registered symbolLists)

Debugging extensions[edit]

These functions add debugger state checks and per-thread breakpoint control beyond the main debugger section.

Debugging extensions

Function
Description

Returns true if the debugger was single stepping an instruction earlier

Breaks the thread with the specific threadID (Note: The thread may not break instantly and may have to be awakened first)

sets a breakpoint of a specific size at the given address for the specified thread. if trigger is bptExecute then size is ignored.

Forms, controls, graphics, dialogs, and streams[edit]

All create... entries here return a CE class object. Assign an owner where the function accepts one so the object's lifetime is managed correctly.

Forms, controls, graphics, dialogs, and streams

Function
Description

Created an empty region

Creates a menu item that gets added to the owner menu

Creates a MainMenu object.

Creates a PopupMenu object.

creates an imagelist object

Creates a stringlist class object (for whatever reason, lua strings are probably easier to use)

creates a CEForm class object(window) and returns the pointer for it. Visible is default true but can be changed

Returns the generated CEform

Returns the generated CEform

Creates a new lua engine form object. If there is no main luaengine window, this will become it.

TFrmAutoInject - Spawns an autoassembler window with the optionally provided script

Creates a Paintbox class object

Creates a Label class object which belongs to the given owner. Owner can be any object inherited from WinControl

Creates a Splitter class object which belongs to the given owner. Owner can be any object inherited from WinControl

Creates a Panel class object which belongs to the given owner. Owner can be any object inherited from WinControl

Creates an Image class object which belongs to the given owner. Owner can be any object inherited from WinControl

Creates an Edit class object which belongs to the given owner. Owner can be any object inherited from WinControl

Creates a Memo class object which belongs to the given owner. Owner can be any object inherited from WinControl

Creates a synedit object. mode: 0=Lua highlighting, 1=Auto Assembler highlighting

Creates a Button class object which belongs to the given owner. Owner can be any object inherited from WinControl

Creates a CheckBox class object which belongs to the given owner. Owner can be any object inherited from WinControl

Creates a ToggleBox class object which belongs to the given owner. Owner can be any object inherited from WinControl

Creates a GroupBox class object which belongs to the given owner. Owner can be any object inherited from WinControl

Creates a RadioGroup class object which belongs to the given owner. Owner can be any object inherited from WinControl

Creates a ListBox class object which belongs to the given owner. Owner can be any object inherited from WinControl

Creates a Calendar class object which belongs to the given owner. Owner can be any object inherited from WinControl. Valid date is between "September 14, 1752" and "December 31, 9999"

Creates a ComboBox class object which belongs to the given owner. Owner can be any object inherited from WinControl

Creates a ProgressBar class object which belongs to the given owner. Owner can be any object inherited from WinControl

Creates a TrackBar class object which belongs to the given owner. Owner can be any object inherited from WinControl

Creates a ListView class object which belongs to the given owner. Owner can be any object inherited from WinControl

Creates a TreeView object.

Creates a Timer object.

Returns a font object (default initialized based on the main ce window)

Returns a Bitmap object

Returns a PortableNetworkGraphic object

Returns a Jpeg object

Returns an Icon object

Returns a empty picture object

returns an initialized GenericHotkey class object. Maximum of 5 keys

Creates a new colordialog

Creates a new colorbox

Creates a find dialog object.

Creates an opendialog object

Creates a save dialog object.

Creates a directory-selection dialog object.

Creates a file-backed stream with the requested mode.

Creates a stream backed by a string buffer.

Returns a new MemScan class object

Creates a FoundList for the provided MemScan object.

Creates a new memoryview window. This window will not receive debug events. Use getMemoryViewForm() function to get the main memoryview window

Threads, synchronization, and structures[edit]

Use synchronization objects when worker threads share state. Structure helpers create or retrieve layout definitions used by the structure dissector.

Threads, synchronization, and structures

Function
Description

Creates and starts a native thread for the supplied Lua function.

Creates a native thread in the suspended state.

Creates a new thread in a new lua state. This is more efficient as no locking inside lua takes place, but has no access to userdefined lua functions and only limited base CE functions.

Returns a critical section object

Returns an event object

Returns an semaphore object

Returns a createMultiReadExclusiveWriteSynchronizer

Opens a structure dissect form for an address.

returns a table of StructureFrm objects (can be useful for finding a structure window with the wanted structure)

Returns the number of Global structures. (Global structures are the visible structures)

Returns the Structure object at the given index

Returns an empty structure object (Not yet added to the Global list. Call structure.addToGlobalStructureList manually)

If PDB files are loaded this will create a structure with that name if it can be found

Low-level memory: DBK and DBVM[edit]

Advanced / platform-specific. These APIs require the DBK driver and/or DBVM and can affect the whole system, not only the opened process.

Low-level memory: DBK and DBVM

Function
Description

Changes all memory access to physical memory

When set to true CE's memory scanner will skip hardware device owned memory. Default state is true

Reads physical memory through the DBK driver and returns a byte table.

Writes physical memory through the DBK driver.

Sets the keys to operate DBVM. Key1 and Key3 are pointersize, key2 is 32-bit. Note that if key1 or key3 are 64-bit wide, 32-bit CE can not use DBVM.

Returns the total memory free for DBVM, and the total number of full pages as secondary result

Creates a DBVM watch that records instruction execution.

Sets a int3 breakpoint at the given address after cloaking that page and when hit does a trace.

Returns DBVM trace status, current entry count, and maximum count.

Requests the active DBVM trace to stop.

Disables the current trace and removes all results

Returns an array of traceentries. (Context of the system at the time of the event, like registers)

Returns the number of breakpoint slots currently available

Returns summary information for a DBVM breakpoint event.

Returns full register, FPU, and stack information for a DBVM breakpoint event.

Sets the state of the frozen thread

Resumes the specific thread. continueMethod can be 0=run, 1=step into

Returns the process and thread IDs for a DBVM breakpoint event.

Looks up the physical address for the given virtual address in the given pagetable base. Returns nil if not paged

Reads the virtual memory of the given process's CR3 value. Returns a bytetable on success, nil if fail to read (paged out)

Writes virtual memory using the supplied process CR3 value.

Direct3D, disassembly, and pipes[edit]

Use this group for overlays, custom disassembly output, named-pipe communication, and related analysis tools.

Direct3D, disassembly, and pipes

Function
Description

Creates a Direct3D hook object.

Creates a disassembler object that can be used to disassemble an instruction and at the same time get more data

Returns the default disassembler object used by a lot of ce's disassembler routines (Only use this from the main thread)

Returns the legacy shared visible-disassembler override object.

Same as Disassembler.OnDisassembleOverride, but does it for all disassemblers, including newly created ones. Tip: Check the sender to see if you should use syntax highlighting codes or not

Unregisters a global disassembler override callback.

Creates or returns the current code DissectCode object

Creates a RipRelativeScanner object.

Returns a LuaPipeClient connected to the given pipename. Nil if the connection fails. Timeout is number of milliseconds before it disconnects on read/write operations. 0 or nil means never

Creates a LuaPipeServer which can be connected to by a pipe client. InputSize and Outputsize define buffers how much data can be in the specific buffer before the writer halts.

Starts a Lua server with the supplied name.

Returns the Ultimap2 form, or nil when it is not open.

Returns the Code Filter form.

SQL and data access[edit]

These factory functions create database connections, transactions, and queries. Configure the appropriate connection before executing a query.

SQL and data access

Function
Description

creates an SQLite3Connection object

Lets you set the path to the sqlite3.dll in case it's not .\win*\sqlite3.dll

creates an ODBCConnection object

Creates an SQLTransaction object

Creates an SQL query object.

Modules, .NET, and diagrams[edit]

The .NET functions query data collected from the target; they require an active .NET data collector and may return empty data when the runtime is unavailable.

Modules, .NET, and diagrams

Function
Description

Returns the hotkey handler thread used internally by CE

Creates a remote thread in the target process.

Loads a DLL/module into the target process.

Returns the current dotnetdatacollector object

Returns all .NET application domains collected from the target.

Returns .NET modules for the specified application domain.

Returns type definitions for the specified .NET module.

Returns methods for the specified .NET type definition.

Returns the parent module and type definition for a .NET type.

Returns field and layout data for the specified .NET type.

Returns parameters for the specified .NET method.

Returns .NET object and field data for the specified address.

Enumerates all collected .NET objects; this may take a long time.

Returns addresses of collected .NET objects with the specified type.

Creates a diagram control object.

Remote execution, XML, and virtual trees[edit]

These APIs create reusable helpers for remote calls, XML documents, custom CE controls, and virtual trees.

Remote execution, XML, and virtual trees

Function
Description

Creates an ExecuteCodeExStub object which the executor can execute

Creates an ExecuteCodeExStub object which the executor can execute

creates a new remote executor

Creates a Cheat Engine custom button control.

Creates an empty XML document

reads the given filename and return an XMLDocument with the parsed contents of the file

reads the given stream and returns an XMLDocument with the parsed contents of the stream

Creates a VirtualStringTree object.

CEServer and Lua string extensions[edit]

CEServer functions apply only after connecting to a server. The string functions are called as methods (for example text:startsWith('CE')).

CEServer and Lua string extensions

Function
Description

Returns whether Cheat Engine is connected to CEServer.

Returns the CEServer path on the target.

Splits a string at the specified separator.

Returns whether a string ends with the specified text.

Returns whether a string starts with the specified text.

Classes[edit]

A compact list of notable classes implemented by Cheat Engine.

Classes

Function
Description

Container for memory records in a cheat table.

Bitmap graphic object for drawing images.

Brush used by a Canvas to fill areas.

Visual button component.

Base class common to button-like controls.

Drawing surface used in paint events for lines, text, and images.

Calendar/date-picker UI control.

Cheat Engine main/form window class.

Component used in Cheat Engine 5.x trainers.

Checkbox UI control supporting checked/unchecked/indeterminate states.

Base class for owner-managed components.

Base class for visible UI controls.

Abstract collection class (used by ListColumns and similar).

Item managed by a Collection.

Edit field with an attached dropdown ListBox.

Synchronization primitive for thread-safe access.

Base class for windowed controls that handle their own painting.

Custom data-type converter for interpreting raw memory.

D3D hook helper for rendering overlays in DirectX 9/10/11 games.

Font texture map used by D3D hook rendering.

Texture management for D3D hook sprites.

Text container used to draw text via D3D hook.

Abstract render object controlling rendering behavior.

Rendered sprite/texture displayed via D3D hook.

Disassembler helper class.

Visual disassembler UI used in Memory View.

Single line entry in a disassembler view.

Structure dissection helper.

Single-line text edit control.

Event wrapper class for callbacks.

Stream class for file-based I/O.

Standard file selection dialog wrapper.

Search/find dialog class.

Font definition and metrics class.

Window/form class.

Companion class for MemScan results; reads result files.

Register hotkeys with CE's hotkey handler.

Abstract base for image/graphic classes.

Lightweight control for simple graphics.

Panel-like container with a header.

Hex display helper used by Memory View.

Hex display UI component in the Memory View.

Icon resource wrapper.

Image control for displaying pictures.

Internet client helper class.

JPEG image handler class.

Static text label control.

Abstract pipe communication class.

Client implementation for pipe communication.

Server implementation for pipe communication.

List box control with selectable strings.

Column descriptor for a ListView.

Container for ListColumn objects.

Entry in a ListView.

Container for ListItem objects.

Multi-column list view control.

Top-level menu bar for a form.

Multi-line text editor control.

Memory scanner class for performing scans.

Common ancestor for menu-related classes.

Menu item descriptor.

Cheat table entry describing an address/value/hotkey etc.

Hotkey interface for a MemoryRecord.

In-memory stream class.

Memory view (hex editor) window class.

Synchronizer for safe concurrent read/write access.

Root base class for most CE classes.

Control for custom painting surface.

Container for multiple pages/tabs.

Container control for grouping child controls.

Pen

Drawing pen used by Canvas for lines.

Container for Graphic objects.

Context (right-click) menu class.

PNG image class.

Visual progress indicator control.

Group of radio-button controls.

Base class for raster image controls.

Helper for RIP-relative instruction scanning.

File open dialog class.

File save dialog class.

Directory selection dialog class.

Semaphore synchronization primitive.

Access and modify Cheat Engine settings and store plugin data.

UI splitter control for resizing panels.

Ordered list container for strings.

Abstract base for text collections.

Stream wrapper around a string buffer.

Structure definition class for memory layouts.

Single element inside a Structure.

Structure editor/dissector form class.

Grouping helper for structure elements.

Symbol lookup class (address ↔ name).

Single page within a PageControl.

Represents a file stored inside a cheat table.

Thread wrapper class.

Non-visual timer component triggering onTimer events.

Toggleable button-like control.

Slider control for numeric values.

Node in a Treeview.

Container for TreeNode objects.

Tree view control.

Base class for windowed controls.

XM player class for tracker music playback.

SQL Classes[edit]

SQL Classes

Function
Description

Base for custom DB connection implementations.

Database container/manager for connections and datasets.

Generic SQL connection abstraction.

SQLite3 connection implementation.

ODBC data source connection.

Transaction object for DB operations.

SQL-specific transaction object.

Single query parameter object.

Parameter container for queries.

Field metadata and values container.

Abstract dataset representing query results.

Database-backed dataset implementation.

In-memory buffered dataset.

Extended/custom SQL query object.

Standard SQL query executor and result-holder.

Class Helper Functions[edit]

Class Helper Functions

Function
Description

Returns true if the given object/class inherits from Object.

Returns true if the object/class inherits from Component.

Returns true if the object/class inherits from Control.

Returns true if the object/class inherits from WinControl.

Creates an instance of the specified registered class (default constructor).

Creates an instance of the specified component class (owner/parent may be required).

Undefined Class Property Functions[edit]

Not all class properties are explicitly exposed; these helpers allow dynamic access to published properties and method/event bindings.

Undefined Class Property Functions

Function
Description

Returns a StringList of published property names for the specified class.

Sets the value of a published property on an object instance (not usable for method properties).

Gets the value of a published property on an object instance (not usable for method properties).

Assigns a Lua function to a method/event property on an object.

Retrieves a callable wrapper to invoke the original method/property on the object.