Difference between revisions of "Lua"

From Cheat Engine
Jump to navigation Jump to search
m (Fixed Link Display Error.)
 
(34 intermediate revisions by 11 users not shown)
Line 1: Line 1:
 +
<!-- Updated to 6.7 celua.text TheyCallMeTim13 -->
 
[[Category:Lua]]
 
[[Category:Lua]]
Cheat Engine comes with an extensive set of Lua functions you can use inside cheattables, trainers and standalone scripts.
+
Cheat Engine comes with an extensive set of Lua functions you can use inside cheat tables, trainers and standalone scripts.
  
 +
== Variables ==
 +
 +
=== Globals ===
 +
{| class="wikitable" style="width:85%;"
 +
! Name
 +
! Type
 +
! Description
 +
|-
 +
| [[Lua:TrainerOrigin|TrainerOrigin]]
 +
| string
 +
| Path of the trainer that launched Cheat Engine. Only set when Cheat Engine was launched as a trainer.
 +
|-
 +
| [[Lua:process|process]]
 +
| string
 +
| Main module name of the currently opened process (e.g. <code>mygame.exe</code> or module name).
 +
|-
 +
| [[Lua:MainForm|MainForm]]
 +
| object
 +
| The main Cheat Engine GUI form object.
 +
|-
 +
| [[Lua:AddressList|AddressList]]
 +
| object
 +
| The address list object of the main Cheat Engine GUI (cheat table address list).
 +
|}
 +
 +
=== CPU / Debug Variables (Registers) ===
 +
{| class="wikitable" style="width:85%;"
 +
! 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 ==
 
== Functions ==
  
 +
=== Cheat Table ===
 +
These functions help manage the cheat table and its files.
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:getAddressList|getAddressList]]
 +
| Returns the cheat table [[Lua:Class:Addresslist|Addresslist]] object.
 +
|-
 +
| [[Lua:findTableFile|findTableFile]]
 +
| Returns a [[Lua:Class:TableFile|TableFile]] stored in the cheat table (search by filename or identifier).
 +
|-
 +
| [[Lua:createTableFile|createTableFile]]
 +
| Adds a new file entry to the cheat table.
 +
|-
 +
| [[Lua:loadTable|loadTable]]
 +
| Loads a ".ct" or ".cetrainer" file or stream into the cheat table.
 +
|-
 +
| [[Lua:saveTable|saveTable]]
 +
| Saves the current cheat table to disk.
 +
|}
 +
 +
=== Trainers ===
 +
Functions related to the trainer (.exe) generator.
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:registerEXETrainerFeature|registerEXETrainerFeature]]
 +
| Adds a new feature to the EXE trainer generator window and calls your callback when a user builds a .exe trainer.
 +
|-
 +
| [[Lua:unregisterEXETrainerFeature|unregisterEXETrainerFeature]]
 +
| Unregisters a previously registered trainer feature.
 +
|}
 +
 +
=== Protection ===
 +
Functions for protecting Cheat Engine or encoding code.
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:activateProtection|activateProtection]]
 +
| Prevents basic memory scanners from opening or inspecting the Cheat Engine process.
 +
|-
 +
| [[Lua:enableDRM|enableDRM]]
 +
| Enables kernel-mode protections or DRM measures to prevent normal memory scanners from reading the Cheat Engine process.
 +
|-
 +
| [[Lua:encodeFunction|encodeFunction]]
 +
| Encodes a given Lua function to a string that can be stored/transferred; can be decoded later with [[Lua:decodeFunction|decodeFunction]].
 +
|-
 +
| [[Lua:decodeFunction|decodeFunction]]
 +
| Decodes an encoded function string back into a callable Lua function.
 +
|}
 +
 +
=== Scanning ===
 +
Functions that control and query memory scans.
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:AOBScan|AOBScan]]
 +
| Scans the currently opened process for an array-of-bytes (AOB) pattern and returns a [[Lua:Class:StringList|StringList]] of all matches.
 +
|-
 +
| [[Lua:AOBScanModuleUnique|AOBScanModuleUnique]]
 +
| Scans the process memory for a byte pattern and returns the address if exactly one unique match is found; returns <code>nil</code> otherwise.
 +
|-
 +
| [[Lua:AOBScanUnique|AOBScanUnique]]
 +
| Scans the entire process for a pattern and returns the address if exactly one unique match exists; returns <code>nil</code> otherwise.
 +
|-
 +
| [[Lua:getCurrentMemscan|getCurrentMemscan]]
 +
| Returns the currently active scan session as a [[Lua:Class:MemScan|MemScan]] object.
 +
|}
 +
 +
=== Process ===
 +
Functions for creating/opening processes and querying system/process state.
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:createProcess|createProcess]]
 +
| Creates (and optionally debugs) a new process.
 +
|-
 +
| [[Lua:openProcess|openProcess]]
 +
| Opens a process given a process name or PID; attaches Cheat Engine to it for memory access.
 +
|-
 +
| [[Lua:onOpenProcess|onOpenProcess]]
 +
| Callback invoked by Cheat Engine when it opens a process (user-defined handler).
 +
|-
 +
| [[Lua:getForegroundProcess|getForegroundProcess]]
 +
| Returns the process ID (PID) of the currently foreground (top) window process.
 +
|-
 +
| [[Lua:getOpenedProcessID|getOpenedProcessID]]
 +
| Returns the PID of the currently opened/attached process.
 +
|-
 +
| [[Lua:getProcessIDFromProcessName|getProcessIDFromProcessName]]
 +
| Returns the PID for a given process name (if running).
 +
|-
 +
| [[Lua:openFileAsProcess|openFileAsProcess]]
 +
| Opens a file and treats it like a process (gives memory access similar to opening a process).
 +
|-
 +
| [[Lua:saveOpenedFile|saveOpenedFile]]
 +
| Saves changes made to the opened file.
 +
|-
 +
| [[Lua:setPointerSize|setPointerSize]]
 +
| 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.
 +
|-
 +
| [[Lua:setAssemblerMode|setAssemblerMode]]
 +
| Sets assembler bit mode: <code>0</code> = 32-bit, <code>1</code> = 64-bit.
 +
|-
 +
| [[Lua:getProcesslist|getProcesslist]]
 +
| Returns a system process list object.
 +
|-
 +
| [[Lua:getWindowlist|getWindowlist]]
 +
| Returns a list of top-level windows.
 +
|-
 +
| [[Lua:pause|pause]]
 +
| Pauses the currently opened process.
 +
|-
 +
| [[Lua:unpause|unpause]]
 +
| Resumes the currently opened process.
 +
|-
 +
| [[Lua:targetIs64Bit|targetIs64Bit]]
 +
| Returns <code>true</code> if the target process is 64-bit, otherwise <code>false</code>.
 +
|-
 +
| [[Lua:enumModules|enumModules]]
 +
| Returns a table with information about each module in the current process (or a specified PID).
 +
|-
 +
| [[Lua:closeRemoteHandle|closeRemoteHandle]]
 +
| Closes a remote handle to a process.
 +
|}
  
=== Cheat table ===
+
=== Threads ===
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:getCPUCount|getCPUCount]]
 +
| Returns the number of CPU cores available on the system.
 +
|-
 +
| [[Lua:getThreadlist|getThreadlist]]
 +
| Fills a List object with the thread list of the currently opened process (returns thread IDs and basic info).
 +
|-
 +
| [[Lua:inMainThread|inMainThread]]
 +
| Returns <code>true</code> if the current Lua code is running in the main thread (available in CE 6.4+); otherwise <code>false</code>.
 +
|-
 +
| [[Lua:synchronize|synchronize]]
 +
| 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.
 +
|-
 +
| [[Lua:queue|queue]]
 +
| Schedules the provided function to run in the main thread but does not wait for the result (fire-and-forget).
 +
|-
 +
| [[Lua:checkSynchronize|checkSynchronize]]
 +
| 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>.
 +
|}
  
These functions help manage the cheat table.
+
=== Handles ===
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:getHandleList|getHandleList]]
 +
| Returns a table (or list object) containing system handles (open handles) for the system or the current process, depending on context.
 +
|}
  
* [[getAddressList]]: Returns the cheat table addresslist object
+
=== Addresses ===
* [[findTableFile]]: Returns a [[TableFile]] stored in the cheat table
+
These functions help convert between memory addresses and symbol/CE address string representations.
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:getAddress|getAddress]]
 +
| Returns the numeric address of a symbol (module+export, label, or CE symbol). Raises an error if the symbol cannot be resolved.
 +
|-
 +
| [[Lua:getAddressSafe|getAddressSafe]]
 +
| Same as <code>getAddress</code> but returns <code>nil</code> if the symbol cannot be found (does not throw).
 +
|-
 +
| [[Lua:getNameFromAddress|getNameFromAddress]]
 +
| Returns the address formatted as a string, preferring symbol/module+offset notation when available.
 +
|-
 +
| [[Lua:registerSymbol|registerSymbol]]
 +
| Assigns the specified symbol name to an address (adds a user-defined symbol).
 +
|-
 +
| [[Lua:unregisterSymbol|unregisterSymbol]]
 +
| Removes a previously registered symbol mapping for an address.
 +
|-
 +
| [[Lua:getSymbolInfo|getSymbolInfo]]
 +
| Returns a table/object with symbol information (module name, search key, address, size), matching the [[Lua:Class:SymbolList|SymbolList]] structure.
 +
|-
 +
| [[Lua:reinitializeSymbolhandler|reinitializeSymbolhandler]]
 +
| Reinitializes the symbol handler (useful after loading new modules).
 +
|-
 +
| [[Lua:inModule|inModule]]
 +
| Returns <code>true</code> if the specified address lies inside a loaded module.
 +
|-
 +
| [[Lua:inSystemModule|inSystemModule]]
 +
| Returns <code>true</code> if the address is inside a system module (OS module), e.g., kernel or system DLLs.
 +
|-
 +
| [[Lua:getModuleSize|getModuleSize]]
 +
| Returns the size (in bytes) of the specified module. Use <code>getAddress</code> to retrieve the module base address first if needed.
 +
|-
 +
| [[Lua:errorOnLookupFailure|errorOnLookupFailure]]
 +
| Sets whether address/symbol lookups will throw errors on failure or return <code>0</code>/<code>nil</code> depending on configuration.
 +
|-
 +
| [[Lua:registerSymbolLookupCallback|registerSymbolLookupCallback]]
 +
| Registers a callback function invoked when a symbol is parsed/loaded.
 +
|-
 +
| [[Lua:unregisterSymbolLookupCallback|unregisterSymbolLookupCallback]]
 +
| Unregisters a previously registered symbol lookup callback.
 +
|-
 +
| [[Lua:registerAddressLookupCallback|registerAddressLookupCallback]]
 +
| Registers a callback called when an address-to-name conversion is requested.
 +
|-
 +
| [[Lua:unregisterAddressLookupCallback|unregisterAddressLookupCallback]]
 +
| Unregisters the address lookup callback.
 +
|-
 +
| [[Lua:reinitializeDotNetSymbolhandler|reinitializeDotNetSymbolhandler]]
 +
| Reinitializes only the .NET portion of the symbol handler (useful when .NET modules change).
 +
|}
  
 +
=== Memory ===
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:allocateMemory|allocateMemory]]
 +
| Allocates executable/non-executable memory in the target process and returns the allocated address.
 +
|-
 +
| [[Lua:deAlloc|deAlloc]]
 +
| Frees memory previously allocated in the target process.
 +
|-
 +
| [[Lua:allocateSharedMemory|allocateSharedMemory]]
 +
| Creates or opens a named shared memory object of the given size for interprocess communication.
 +
|-
 +
| [[Lua:createSection|createSection]]
 +
| Creates a memory section object (OS-specific) for sharing or mapping memory.
 +
|-
 +
| [[Lua:mapViewOfSection|mapViewOfSection]]
 +
| Maps a created section into the process address space, returning the mapped base address.
 +
|-
 +
| [[Lua:unMapViewOfSection|unMapViewOfSection]]
 +
| Unmaps a previously mapped section view from the process address space.
 +
|-
 +
| [[Lua:copyMemory|copyMemory]]
 +
| Copies memory from a source address to a destination address (can be used within target process or between processes depending on API).
 +
|-
 +
| [[Lua:allocateKernelMemory|allocateKernelMemory]]
 +
| Allocates a block of nonpaged kernel memory (requires driver or appropriate privileges) and returns its address.
 +
|-
 +
| [[Lua:freeKernelMemory|freeKernelMemory]]
 +
| Frees kernel-mode memory previously allocated.
 +
|-
 +
| [[Lua:mapMemory|mapMemory]]
 +
| Maps memory from one process context into another usermode context (maps a specified address from PID A into PID B's address space).
 +
|-
 +
| [[Lua:unmapMemory|unmapMemory]]
 +
| Unmaps memory previously mapped with <code>mapMemory</code>.
 +
|-
 +
| [[Lua:createMemoryStream|createMemoryStream]]
 +
| Creates a memory stream object that can be used to read/write memory data conveniently from Lua.
 +
|}
  
=== Scanning ===
+
==== Reading from Target Process ====
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:readBytes|readBytes]]
 +
| Reads raw bytes at the given address. If <code>ReturnAsTable</code> is true, returns a table; otherwise returns multiple byte values.
 +
|-
 +
| [[Lua:readSmallInteger|readSmallInteger]]
 +
| Reads a 16-bit (word) integer from the specified address. Optional second parameter: if true, reads as signed integer.
 +
|-
 +
| [[Lua:readInteger|readInteger]]
 +
| Reads a 32-bit (dword) integer from the specified address. Optional second parameter: if true, reads as signed integer.
 +
|-
 +
| [[Lua:readQword|readQword]]
 +
| Reads a 64-bit (qword) integer from the specified address.
 +
|-
 +
| [[Lua:readPointer|readPointer]]
 +
| Reads a pointer-sized value: <code>readQword</code> on 64-bit targets, <code>readInteger</code> on 32-bit targets.
 +
|-
 +
| [[Lua:readFloat|readFloat]]
 +
| Reads a single-precision (32-bit) floating-point value from the specified address.
 +
|-
 +
| [[Lua:readDouble|readDouble]]
 +
| Reads a double-precision (64-bit) floating-point value from the specified address.
 +
|-
 +
| [[Lua:readString|readString]]
 +
| Reads a null-terminated string from memory up to <code>maxlength</code> bytes (prevents infinite loops on corrupted memory).
 +
|-
 +
| [[Lua:readRegionFromFile|readRegionFromFile]]
 +
| Reads a region from a file and writes it to a specific address in the target process.
 +
|}
  
These functions control Cheat Engine's scanning.
+
==== Reading from Cheat Engine Memory ====
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:readBytesLocal|readBytesLocal]]
 +
| Same as <code>readBytes</code>, but reads from Cheat Engine's own memory.
 +
|-
 +
| [[Lua:readSmallIntegerLocal|readSmallIntegerLocal]]
 +
| Reads a 16-bit integer from CE's memory. Optional: use signed if second parameter is true.
 +
|-
 +
| [[Lua:readIntegerLocal|readIntegerLocal]]
 +
| Reads a 32-bit integer from CE's memory. Optional: use signed if second parameter is true.
 +
|-
 +
| [[Lua:readQwordLocal|readQwordLocal]]
 +
| Reads a 64-bit integer from CE's memory.
 +
|-
 +
| [[Lua:readPointerLocal|readPointerLocal]]
 +
| Reads a pointer-sized value from CE's memory (64-bit or 32-bit depending on CE build).
 +
|-
 +
| [[Lua:readFloatLocal|readFloatLocal]]
 +
| Reads a single-precision float from CE's memory.
 +
|-
 +
| [[Lua:readDoubleLocal|readDoubleLocal]]
 +
| Reads a double-precision float from CE's memory.
 +
|-
 +
| [[Lua:readStringLocal|readStringLocal]]
 +
| Reads a null-terminated string from CE's memory.
 +
|}
  
* [[AOBScan]]: Scans the currently opened process and returns a StringList object containing all the results
+
==== Writing to Target Process ====
* [[getCurrentMemscan]]: Returns the currently active scan session as a MemScan object
+
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:writeBytes|writeBytes]]
 +
| Writes the given bytes (from a table) to the specified address in the target process.
 +
|-
 +
| [[Lua:writeSmallInteger|writeSmallInteger]]
 +
| Writes a 16-bit integer to the specified address. Returns true on success.
 +
|-
 +
| [[Lua:writeInteger|writeInteger]]
 +
| Writes a 32-bit integer to the specified address. Returns true on success.
 +
|-
 +
| [[Lua:writeQword|writeQword]]
 +
| Writes a 64-bit integer to the specified address. Returns true on success.
 +
|-
 +
| [[Lua:writeFloat|writeFloat]]
 +
| Writes a single-precision float to the specified address. Returns true on success.
 +
|-
 +
| [[Lua:writeDouble|writeDouble]]
 +
| Writes a double-precision float to the specified address. Returns true on success.
 +
|-
 +
| [[Lua:writeString|writeString]]
 +
| Writes a string to the specified address (typically null-terminated). Returns true on success.
 +
|-
 +
| [[Lua:writeRegionToFile|writeRegionToFile]]
 +
| Writes a memory region to a file. Returns the number of bytes written.
 +
|}
  
 +
==== Writing to Cheat Engine Memory ====
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:writeSmallIntegerLocal|writeSmallIntegerLocal]]
 +
| Writes a 16-bit integer to CE's memory. Returns true on success.
 +
|-
 +
| [[Lua:writeIntegerLocal|writeIntegerLocal]]
 +
| Writes a 32-bit integer to CE's memory. Returns true on success.
 +
|-
 +
| [[Lua:writeQwordLocal|writeQwordLocal]]
 +
| Writes a 64-bit integer to CE's memory. Returns true on success.
 +
|-
 +
| [[Lua:writeFloatLocal|writeFloatLocal]]
 +
| Writes a single-precision float to CE's memory. Returns true on success.
 +
|-
 +
| [[Lua:writeDoubleLocal|writeDoubleLocal]]
 +
| Writes a double-precision float to CE's memory. Returns true on success.
 +
|-
 +
| [[Lua:writeStringLocal|writeStringLocal]]
 +
| Writes a string to CE's memory. Returns true on success.
 +
|-
 +
| [[Lua:writeBytesLocal|writeBytesLocal]]
 +
| Writes the given bytes (from a table) to CE's memory.
 +
|}
  
=== Process ===
+
=== Conversions ===
  
* [[openProcess]]: Causes cheat engine to open the given processname or id
+
==== Encoding/Decoding ====
* [[onOpenProcess]]: Called by CE when it opens a process (userdefined)
+
{| class="wikitable" style="width:85%;"
* [[getForegroundProcess]]: Returns the processid of the current foreground window
+
! Function
* [[getOpenedProcessID]]: Returns the currently opened process
+
! Description
* [[getProcessIDFromProcessName]]: Returns a processid
+
|-
* [[pause]]: Pauses the current opened process
+
| [[Lua:ansiToUtf8|ansiToUtf8]]
* [[unpause]]: Resumes the current opened process
+
| Converts a string from ANSI encoding to UTF-8 encoding.
* [[targetIs64Bit]]: Returns true if the target process is 64-bit, false if 32-bit
+
|-
* [[speedhack_setSpeed]]: Enables the speedhack if it was not active yet and sets the given speed
+
| [[Lua:utf8ToAnsi|utf8ToAnsi]]
 +
| Converts a string from UTF-8 encoding to ANSI encoding.
 +
|-
 +
| [[Lua:stringToMD5String|stringToMD5String]]
 +
| Computes and returns the MD5 hash of a string as a hexadecimal string.
 +
|-
 +
| [[Lua:integerToUserData|integerToUserData]]
 +
| Converts a given integer to a userdata variable.
 +
|-
 +
| [[Lua:userDataToInteger|userDataToInteger]]
 +
| Converts a given userdata variable back to an integer.
 +
|}
  
 +
==== To Byte Table ====
 +
Convert data types into byte tables (tables of individual byte values).
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:wordToByteTable|wordToByteTable]]
 +
| Converts a 16-bit word to a byte table.
 +
|-
 +
| [[Lua:dwordToByteTable|dwordToByteTable]]
 +
| Converts a 32-bit dword to a byte table.
 +
|-
 +
| [[Lua:qwordToByteTable|qwordToByteTable]]
 +
| Converts a 64-bit qword to a byte table.
 +
|-
 +
| [[Lua:floatToByteTable|floatToByteTable]]
 +
| Converts a single-precision float to a byte table.
 +
|-
 +
| [[Lua:doubleToByteTable|doubleToByteTable]]
 +
| Converts a double-precision float to a byte table.
 +
|-
 +
| [[Lua:stringToByteTable|stringToByteTable]]
 +
| Converts a string (ANSI/UTF-8) to a byte table.
 +
|-
 +
| [[Lua:wideStringToByteTable|wideStringToByteTable]]
 +
| Converts a string to a wide string (Unicode) and then to a byte table.
 +
|}
  
=== Addresses ===
+
==== From Byte Table ====
 +
Convert byte tables back into data types.
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:byteTableToWord|byteTableToWord]]
 +
| Converts a byte table to a 16-bit word.
 +
|-
 +
| [[Lua:byteTableToDword|byteTableToDword]]
 +
| Converts a byte table to a 32-bit dword.
 +
|-
 +
| [[Lua:byteTableToQword|byteTableToQword]]
 +
| Converts a byte table to a 64-bit qword.
 +
|-
 +
| [[Lua:byteTableToFloat|byteTableToFloat]]
 +
| Converts a byte table to a single-precision float.
 +
|-
 +
| [[Lua:byteTableToDouble|byteTableToDouble]]
 +
| Converts a byte table to a double-precision float.
 +
|-
 +
| [[Lua:byteTableToString|byteTableToString]]
 +
| Converts a byte table to a string.
 +
|-
 +
| [[Lua:byteTableToWideString|byteTableToWideString]]
 +
| Converts a byte table to a wide string (Unicode).
 +
|}
  
These functions help convert between memory addresses and [[symbol]]s/[[CEAddressString]]s.
+
==== Binary Operations ====
 +
Bitwise operations on integers.
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:bOr|bOr]]
 +
| Bitwise OR operation.
 +
|-
 +
| [[Lua:bXor|bXor]]
 +
| Bitwise XOR (exclusive OR) operation.
 +
|-
 +
| [[Lua:bAnd|bAnd]]
 +
| Bitwise AND operation.
 +
|-
 +
| [[Lua:bShl|bShl]]
 +
| Bitwise shift left operation.
 +
|-
 +
| [[Lua:bShr|bShr]]
 +
| Bitwise shift right operation.
 +
|-
 +
| [[Lua:bNot|bNot]]
 +
| Bitwise NOT (complement) operation.
 +
|}
  
* [[getAddress]]: Returns the address of a symbol. Can be a modulename or an export
+
=== Input Devices ===
* [[getNameFromAddress]]: Returns the given address in string form, returning the symbol representation if possible
 
* [[registerSymbol]]: Assign the specified symbolname to an address
 
* [[unregisterSymbol]]: Remove the name from the address
 
* [[reinitializeSymbolhandler]]: Reinitializes the symbolhandler. E.g when new modules have been loaded
 
* [[inModule]]: Returns true if the given address is inside a module
 
* [[inSystemModule]]: Returns true if the given address is inside a system module
 
* [[errorOnLookupFailure]]: Set whether address lookups will throw errors, or just return 0.
 
  
 +
==== Keyboard & Mouse ====
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:getMousePos|getMousePos]]
 +
| Returns the current mouse cursor position as ''X'' and ''Y'' coordinates.
 +
|-
 +
| [[Lua:setMousePos|setMousePos]]
 +
| Sets the mouse cursor position to the specified ''X'' and ''Y'' coordinates.
 +
|-
 +
| [[Lua:isKeyPressed|isKeyPressed]]
 +
| Returns <code>true</code> if the specified key is currently held down.
 +
|-
 +
| [[Lua:keyDown|keyDown]]
 +
| Simulates pressing a key (puts the key into down state).
 +
|-
 +
| [[Lua:keyUp|keyUp]]
 +
| Simulates releasing a key (puts the key into up state).
 +
|-
 +
| [[Lua:doKeyPress|doKeyPress]]
 +
| Simulates a complete key press (down and up).
 +
|-
 +
| [[Lua:mouse_event|mouse_event]]
 +
| 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].
 +
|-
 +
| [[Lua:setGlobalKeyPollInterval|setGlobalKeyPollInterval]]
 +
| Sets the global key poll interval (frequency of keyboard state updates).
 +
|-
 +
| [[Lua:setGlobalDelayBetweenHotkeyActivation|setGlobalDelayBetweenHotkeyActivation]]
 +
| Sets the minimum delay (in milliseconds) between consecutive activations of the same hotkey.
 +
|}
  
=== Memory ===
+
==== Game Controller ====
 +
XBox/game controller input.
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:getXBox360ControllerState|getXBox360ControllerState]]
 +
| Fetches the current state (buttons, triggers, sticks) of a connected XBox 360 controller.
 +
|-
 +
| [[Lua:setXBox360ControllerVibration|setXBox360ControllerVibration]]
 +
| Sets the speed of the left and right vibration motors in an XBox 360 controller (for haptic feedback).
 +
|}
  
These functions read/write memory from the opened process.
+
==== Clipboard ====
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:writeToClipboard|writeToClipboard]]
 +
| Writes the given text to the system clipboard.
 +
|}
  
;Reading
+
=== Screen ===
* [[readBytes]]: Returns the bytes at the given address. If ReturnAsTable is true it will return a table instead of multiple bytes
+
{| class="wikitable" style="width:85%;"
* [[readInteger]]: Reads a integer from the specified address
+
! Function
* [[readFloat]]: Reads a single precision floating point value from the specified address
+
! Description
* [[readDouble]]: Reads a double precision floating point value from the specified address
+
|-
* [[readString]]: Reads a string from memory until it hits a 0-terminator. maxlength is just so you won't freeze for too long
+
| [[Lua:getScreenHeight|getScreenHeight]]
* [[readRegionFromFile]]: Writes the given file to a specific address
+
| Returns the height of the screen in pixels.
 +
|-
 +
| [[Lua:getScreenWidth|getScreenWidth]]
 +
| Returns the width of the screen in pixels.
 +
|-
 +
| [[Lua:getScreenDPI|getScreenDPI]]
 +
| Returns the screen DPI (dots per inch) for determining screen scaling/density.
 +
|-
 +
| [[Lua:getWorkAreaHeight|getWorkAreaHeight]]
 +
| Returns the height of the usable work area (excludes taskbars).
 +
|-
 +
| [[Lua:getWorkAreaWidth|getWorkAreaWidth]]
 +
| Returns the width of the usable work area (excludes taskbars).
 +
|-
 +
| [[Lua:getScreenCanvas|getScreenCanvas]]
 +
| Returns a Canvas object for drawing directly to the screen. Limited usefulness in practice due to performance constraints.
 +
|-
 +
| [[Lua:getPixel|getPixel]]
 +
| Returns the RGB color value of a pixel at the specified screen coordinates.
 +
|}
  
;Writing
+
=== Sounds ===
* [[writeBytes]]: Write the given bytes to the given address from a table
 
* [[writeInteger]]: Writes an integer to the specified address
 
* [[writeFloat]]: Writes a single precision floating point to the specified address
 
* [[writeDouble]]: Writes a double precision floating point to the specified address
 
* [[writeString]]: Write a string to the specified address
 
* [[writeRegionToFile]]: Writes the given region to a file. Returns the number of bytes written
 
  
 +
==== General Audio ====
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:playSound|playSound]]
 +
| Plays an audio file (supports various formats like .wav, .mp3, etc.).
 +
|-
 +
| [[Lua:beep|beep]]
 +
| Plays a system beep/ping sound.
 +
|}
  
=== Input devices ===
+
=== Text-to-Speech ===
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:speak|speak]]
 +
| 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].
 +
|-
 +
| [[Lua:speakEnglish|speakEnglish]]
 +
| Speaks the given text using an English voice by wrapping it in an XML voice specification.
 +
|}
  
These functions get/set keyboard/mouse input.
+
==== XM Player ====
 +
Plays tracked music (XM format) using the built-in XM player.
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:xmplayer_playXM|xmplayer_playXM]]
 +
| Plays an XM audio file given its filename.
 +
|-
 +
| [[Lua:xmplayer_pause|xmplayer_pause]]
 +
| Pauses the currently playing XM audio file.
 +
|-
 +
| [[Lua:xmplayer_resume|xmplayer_resume]]
 +
| Resumes playback of a paused XM audio file.
 +
|-
 +
| [[Lua:xmplayer_stop|xmplayer_stop]]
 +
| Stops XM audio playback completely.
 +
|-
 +
| [[Lua:xmplayer_isPlaying|xmplayer_isPlaying]]
 +
| Returns <code>true</code> if an XM audio file is currently being played.
 +
|}
  
* [[getMousePos]]: Returns the x,y coordinates of the mouse
+
=== Fonts ===
* [[setMousePos]]: Sets the mouse position
+
{| class="wikitable" style="width:85%;"
* [[isKeyPressed]]: Returns true if the specified key is currently pressed
+
! Function
* [[keyDown]]: Causes the key to go into down state
+
! Description
* [[keyUp]]: Causes the key to go up
+
|-
* [[doKeyPress]]: Simulates a key press
+
| [[Lua:loadFontFromStream|loadFontFromStream]]
 +
| Loads a font from a memory stream and returns a handle/ID for later use with <code>unloadLoadedFont</code>.
 +
|-
 +
| [[Lua:unloadLoadedFont|unloadLoadedFont]]
 +
| Unloads a previously loaded font by its handle/ID, freeing resources.
 +
|}
  
 +
=== Forms and Windows ===
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:findWindow|findWindow]]
 +
| Finds a window by class name and/or window title/caption.
 +
|-
 +
| [[Lua:getWindow|getWindow]]
 +
| 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].
 +
|-
 +
| [[Lua:getWindowCaption|getWindowCaption]]
 +
| Returns the caption/title text of the specified window.
 +
|-
 +
| [[Lua:getWindowClassName|getWindowClassName]]
 +
| Returns the class name of the specified window.
 +
|-
 +
| [[Lua:getWindowProcessID|getWindowProcessID]]
 +
| Returns the process ID (PID) of the process that owns the specified window.
 +
|-
 +
| [[Lua:getForegroundWindow|getForegroundWindow]]
 +
| Returns the handle of the topmost (foreground) window currently active.
 +
|-
 +
| [[Lua:sendMessage|sendMessage]]
 +
| Sends a Windows message to the specified window.
 +
|-
 +
| [[Lua:hookWndProc|hookWndProc]]
 +
| Hooks a window's window procedure (WndProc) to intercept and handle messages.
 +
|-
 +
| [[Lua:unhookWndProc|unhookWndProc]]
 +
| Uninstalls a WndProc hook previously installed via <code>hookWndProc</code>.
 +
|}
  
 
=== Cheat Engine ===
 
=== Cheat Engine ===
 +
Functions for managing and controlling Cheat Engine itself.
 +
 +
==== Version and Information ====
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:getCEVersion|getCEVersion]]
 +
| Returns the Cheat Engine version as a floating-point number (e.g. <code>7.5</code>).
 +
|-
 +
| [[Lua:getCheatEngineFileVersion|getCheatEngineFileVersion]]
 +
| Returns full version information: a raw integer and a table containing major, minor, release, and build numbers.
 +
|-
 +
| [[Lua:cheatEngineIs64Bit|cheatEngineIs64Bit]]
 +
| Returns <code>true</code> if Cheat Engine is running as 64-bit; <code>false</code> if 32-bit.
 +
|-
 +
| [[Lua:getCheatEngineProcessID|getCheatEngineProcessID]]
 +
| Returns the process ID of the Cheat Engine process itself.
 +
|-
 +
| [[Lua:getCheatEngineDir|getCheatEngineDir]]
 +
| Returns the folder path where Cheat Engine (or the current trainer) is located.
 +
|}
 +
 +
==== Management ====
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:closeCE|closeCE]]
 +
| Closes Cheat Engine.
 +
|-
 +
| [[Lua:getFreezeTimer|getFreezeTimer]]
 +
| Returns the Timer object responsible for freezing/unfreezing values in the address list.
 +
|-
 +
| [[Lua:getUpdateTimer|getUpdateTimer]]
 +
| Returns the Timer object responsible for updating displayed values in the address list.
 +
|-
 +
| [[Lua:getCommonModuleList|getCommonModuleList]]
 +
| Returns the common module list as a [[Lua:Class:StringList|StringList]] object.
 +
|-
 +
| [[Lua:getAutoAttachList|getAutoAttachList]]
 +
| Returns the AutoAttach list as a [[Lua:Class:StringList|StringList]] object.
 +
|-
 +
| [[Lua:connectToCEServer|connectToCEServer]]
 +
| Connects to a remote Cheat Engine server (given host and port). Subsequent operations route through the server.
 +
|-
 +
| [[Lua:reloadSettingsFromRegistry|reloadSettingsFromRegistry]]
 +
| Reloads Cheat Engine settings from the registry and applies them immediately.
 +
|-
 +
| [[Lua:loadPlugin|loadPlugin]]
 +
| Loads the specified plugin.
 +
|-
 +
| [[Lua:getSettings|getSettings]]
 +
| Returns the settings object for accessing/modifying CE configuration.
 +
|-
 +
| [[Lua:registerBinUtil|registerBinUtil]]
 +
| Registers a binutils (assembler/disassembler) toolset with Cheat Engine.
 +
|}
 +
 +
==== Comments and Headers ====
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:getComment|getComment]]
 +
| Gets the user-defined comment attached to the specified address.
 +
|-
 +
| [[Lua:setComment|setComment]]
 +
| Sets a user-defined comment at the specified address.
 +
|-
 +
| [[Lua:getHeader|getHeader]]
 +
| Gets the user-defined header text at the specified address.
 +
|-
 +
| [[Lua:setHeader|setHeader]]
 +
| Sets a user-defined header text at the specified address.
 +
|}
 +
 +
==== Advertising and Support ====
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:supportCheatEngine|supportCheatEngine]]
 +
| Displays an advertising/support window to help fund Cheat Engine development.
 +
|-
 +
| [[Lua:fuckCheatEngine|fuckCheatEngine]]
 +
| Hides/closes the advertising window if it was showing (crude but functional name).
 +
|}
  
These functions help manage Cheat Engine itself.
+
==== Forms and UI ====
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:getFormCount|getFormCount]]
 +
| Returns the total number of forms currently attached to the main CE application.
 +
|-
 +
| [[Lua:getForm|getForm]]
 +
| Returns the form object at the specified index (0-based).
 +
|-
 +
| [[Lua:getMemoryViewForm|getMemoryViewForm]]
 +
| Returns the first MemoryView form object (the hex editor window).
 +
|-
 +
| [[Lua:getMainForm|getMainForm]]
 +
| Returns the main Cheat Engine window form object.
 +
|-
 +
| [[Lua:getSettingsForm|getSettingsForm]]
 +
| Returns the settings/options dialog form object.
 +
|-
 +
| [[Lua:getLuaEngine|getLuaEngine]]
 +
| Returns the Lua engine/console form object (creates it if needed).
 +
|-
 +
| [[Lua:unhideMainCEwindow|unhideMainCEwindow]]
 +
| Shows the main Cheat Engine window (opposite of <code>hideAllCEWindows</code>).
 +
|-
 +
| [[Lua:hideAllCEWindows|hideAllCEWindows]]
 +
| Hides all normal Cheat Engine windows (e.g. the trainer table UI).
 +
|-
 +
| [[Lua:registerFormAddNotification|registerFormAddNotification]]
 +
| Registers a callback function invoked when a form is added to CE's form list.
 +
|-
 +
| [[Lua:unregisterFormAddNotification|unregisterFormAddNotification]]
 +
| Unregisters a previously registered form add notification callback.
 +
|}
  
* [[unhideMainCEwindow]]: Shows the main cheat engine window
+
==== Messages ====
* [[hideAllCEWindows]]: Makes all normal ce windows invisible (e.g trainer table)
+
{| class="wikitable" style="width:85%;"
* [[supportCheatEngine]]: Will show an advertising window which will help keep the development of Cheat Engine going.
+
! Function
* [[fuckCheatEngine]]: Removes the ad window if it was showing
+
! Description
* [[getCheatEngineDir]]: Returns the folder Cheat Engine (or the trainer) is located at.
+
|-
* [[readBytesLocal]]: readBytes, but for Cheat Engine's own memory
+
| [[Lua:showMessage|showMessage]]
* [[writeBytesLocal]]: writeBytes, but for Cheat Engine's own memory
+
| Shows a simple message box with the given text to the user.
* [[cheatEngineIs64Bit]]: Returns true if CE is 64-bit, false if 32-bit
+
|-
* [[closeCE]]: Closes ce
+
| [[Lua:messageDialog|messageDialog]]
 +
| Pops up a message dialog box (similar to <code>showMessage</code>, with more control over buttons/options).
 +
|-
 +
| [[Lua:outputDebugString|outputDebugString]]
 +
| Outputs a message using the Windows <code>OutputDebugString</code> API (visible in debuggers).
 +
|-
 +
| [[Lua:processMessages|processMessages]]
 +
| Processes pending window messages in the event queue, allowing button clicks and UI updates to be handled.
 +
|}
  
; Messages
+
==== Input ====
* [[showMessage]]: Shows a messagebox with the given text
+
{| class="wikitable" style="width:85%;"
* [[messageDialog]]: Pops up a messagebox
+
! Function
 +
! Description
 +
|-
 +
| [[Lua:inputQuery|inputQuery]]
 +
| Shows a dialog prompting the user to input a string. Returns the entered string, or <code>nil</code> if cancelled (CE 6.4+).
 +
|}
  
; Sounds
+
==== Shortcuts ====
* [[playSound]]: Plays a sound file
+
{| class="wikitable" style="width:85%;"
* [[beep]]: Plays the fabulous beep/ping sound!
+
! Function
* [[xmplayer_playXM]]: Plays the given filename using the xmplayer
+
! Description
* [[xmplayer_pause]]: Pauses the current xm audio file
+
|-
* [[xmplayer_resume]]: Resumes the current xm audio file
+
| [[Lua:shortCutToText|shortCutToText]]
* [[xmplayer_stop]]: Stops the current xm audio file
+
| Converts a shortcut integer value to its textual representation (e.g. <code>"Ctrl+Alt+A"</code>). (CE 6.4+)
* [[xmplayer_isPlaying]]: Returns true if there is currenty an xm audio file being played
+
|-
 +
| [[Lua:textToShortCut|textToShortCut]]
 +
| Converts a text representation (e.g. <code>"Ctrl+Alt+A"</code>) to a shortcut integer value. (CE 6.4+)
 +
|-
 +
| [[Lua:convertKeyComboToString|convertKeyComboToString]]
 +
| Converts a key combination to its string representation, matching the hotkey handler's format.
 +
|}
  
 +
==== Speed Hack ====
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:speedhack_setSpeed|speedhack_setSpeed]]
 +
| Enables the speed hack (if not already active) and sets the game/process speed multiplier (e.g. <code>2.0</code> for 2x speed).
 +
|-
 +
| [[Lua:speedhack_getSpeed|speedhack_getSpeed]]
 +
| Returns the current speed hack multiplier value that was last set.
 +
|}
  
 
=== Lua ===
 
=== Lua ===
 +
Functions for managing the Lua engine and state.
 +
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:resetLuaState|resetLuaState]]
 +
| Creates a fresh Lua state, resetting the environment and clearing all previously defined variables/functions.
 +
|-
 +
| [[Lua:sleep|sleep]]
 +
| Pauses execution for the specified number of milliseconds.
 +
|-
 +
| [[Lua:createRef|createRef]]
 +
| Creates and returns an integer reference handle that can store and retrieve Lua objects persistently.
 +
|-
 +
| [[Lua:getRef|getRef]]
 +
| Retrieves the Lua value/object referenced by the given reference handle.
 +
|-
 +
| [[Lua:destroyRef|destroyRef]]
 +
| Destroys and frees a reference handle, removing the reference and allowing garbage collection.
 +
|}
 +
 +
=== Types ===
 +
Functions for registering and managing custom data types.
 +
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:onAutoGuess|onAutoGuess]]
 +
| Registers a callback function invoked by Cheat Engine's auto-guess feature to predict and suggest variable types.
 +
|-
 +
| [[Lua:registerCustomTypeLua|registerCustomTypeLua]]
 +
| Registers a custom data type defined using Lua functions for reading/writing/display logic.
 +
|-
 +
| [[Lua:registerCustomTypeAutoAssembler|registerCustomTypeAutoAssembler]]
 +
| Registers a custom data type defined using an Auto Assembler script.
 +
|}
  
These functions help manage Lua itself.
+
=== Object-oriented ===
 +
Functions for determining class inheritance and type relationships.
  
* [[resetLuaState]]: This will create a new Lua state that will be used.
+
{| class="wikitable" style="width:85%;"
* [[sleep]]: Pauses for the number of specified milliseconds
+
! Function
 +
! Description
 +
|-
 +
| [[Lua:inheritsFromObject|inheritsFromObject]]
 +
| Returns <code>true</code> if the given object is a valid Cheat Engine class instance (inherits from Object).
 +
|-
 +
| [[Lua:inheritsFromComponent|inheritsFromComponent]]
 +
| Returns <code>true</code> if the given object inherits from the Component class.
 +
|-
 +
| [[Lua:inheritsFromControl|inheritsFromControl]]
 +
| Returns <code>true</code> if the given object inherits from the Control class (UI controls).
 +
|-
 +
| [[Lua:inheritsFromWinControl|inheritsFromWinControl]]
 +
| 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.
  
=== Types ===
+
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:autoAssemble|autoAssemble]]
 +
| Executes an Auto Assembler script (given as text) for code injection, patching, or other assembly operations.
 +
|-
 +
| [[Lua:autoAssembleCheck|autoAssembleCheck]]
 +
| Validates an Auto Assembler script for syntax errors. Returns <code>true</code> on success; <code>false</code> with error message on failure.
 +
|-
 +
| [[Lua:disassemble|disassemble]]
 +
| Disassembles the instruction at the given address and returns a formatted string: <code>"address - bytes - opcode  extra"</code>.
 +
|-
 +
| [[Lua:splitDisassembledString|splitDisassembledString]]
 +
| Parses a disassembled instruction string and returns 4 separate strings: address, bytes, opcode, and extra field.
 +
|-
 +
| [[Lua:getInstructionSize|getInstructionSize]]
 +
| Returns the size (in bytes) of the instruction at the given address.
 +
|-
 +
| [[Lua:getPreviousOpcode|getPreviousOpcode]]
 +
| Attempts to find and return the address of the previous instruction (heuristic guess).
 +
|-
 +
| [[Lua:registerAssembler|registerAssembler]]
 +
| Registers a custom callback function for the single-line assembler to convert instruction mnemonics to bytes.
 +
|-
 +
| [[Lua:unregisterAssembler|unregisterAssembler]]
 +
| Unregisters a previously registered custom assembler callback.
 +
|}
  
These functions help structure a process's memory into datatypes.
+
=== Auto Assembler ===
  
* [[onAutoGuess]]: Registers an function to be called whenever autoguess is used to predict a variable type.
+
==== Commands & Hooks ====
* [[registerCustomTypeLua]]: Registers a [[custom type]] based on Lua functions.
+
{| class="wikitable" style="width:85%;"
* [[registerCustomTypeAutoAssembler]]: Registers a custom type based on an auto assembler script.
+
! Function
 +
! Description
 +
|-
 +
| [[Lua:registerAutoAssemblerCommand|registerAutoAssemblerCommand]]
 +
| Registers a custom Auto Assembler command that calls the specified Lua function when invoked in a script.
 +
|-
 +
| [[Lua:unregisterAutoAssemblerCommand|unregisterAutoAssemblerCommand]]
 +
| Unregisters a previously registered Auto Assembler command.
 +
|-
 +
| [[Lua:registerAutoAssemblerPrologue|registerAutoAssemblerPrologue]]
 +
| Registers a callback function invoked before the Auto Assembler parses a script (prologue phase).
 +
|-
 +
| [[Lua:unregisterAutoAssemblerPrologue|unregisterAutoAssemblerPrologue]]
 +
| Unregisters an Auto Assembler prologue callback.
 +
|-
 +
| [[Lua:fullAccess|fullAccess]]
 +
| Changes memory protection on a block of memory to be writable and executable.
 +
|}
  
 +
==== Scripts & Templates ====
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:registerAutoAssemblerTemplate|registerAutoAssemblerTemplate]]
 +
| Registers a reusable template for the Auto Assembler script generator.
 +
|-
 +
| [[Lua:unregisterAutoAssemblerTemplate|unregisterAutoAssemblerTemplate]]
 +
| Unregisters a previously registered Auto Assembler template.
 +
|-
 +
| [[Lua:generateCodeInjectionScript|generateCodeInjectionScript]]
 +
| Generates and appends a default code injection script to the provided script (allocates space, injects code, patches original).
 +
|-
 +
| [[Lua:generateAOBInjectionScript|generateAOBInjectionScript]]
 +
| Generates and appends an Array-of-Bytes (AOB) injection script to the provided script (searches for pattern, injects code).
 +
|-
 +
| [[Lua:generateFullInjectionScript|generateFullInjectionScript]]
 +
| Generates and appends a complete full injection script with all patches and cleanup code.
 +
|-
 +
| [[Lua:generateAPIHookScript|generateAPIHookScript]]
 +
| Generates an Auto Assembler script that hooks (intercepts) the given API function address.
 +
|}
  
=== Object-oriented ===
+
=== Debugger ===
 +
Functions for managing the debugger. See [[Lua Debugging]] for detailed information.
  
These functions determine how a Lua object fits in the class hierarchy.
+
==== Status and Information ====
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:debug_isDebugging|debug_isDebugging]]
 +
| Returns <code>true</code> if the debugger has been started and is active.
 +
|-
 +
| [[Lua:debug_getCurrentDebuggerInterface|debug_getCurrentDebuggerInterface]]
 +
| Returns the current debugger interface type: <code>1</code>=Windows, <code>2</code>=VEH, <code>3</code>=Kernel, <code>nil</code>=no debugging.
 +
|-
 +
| [[Lua:debug_canBreak|debug_canBreak]]
 +
| Returns <code>true</code> if the target process can stop on a breakpoint. (CE 6.4+)
 +
|-
 +
| [[Lua:debug_isBroken|debug_isBroken]]
 +
| Returns <code>true</code> if the debugger is currently halted on a thread (at a breakpoint).
 +
|-
 +
| [[Lua:debug_getBreakpointList|debug_getBreakpointList]]
 +
| Returns a Lua table containing all currently active breakpoint addresses.
 +
|}
  
* [[inheritsFromObject]]: Returns true if given any class
+
==== Breakpoint Management ====
* [[inheritsFromComponent]]: Returns true if the given object inherits from the Component class
+
{| class="wikitable" style="width:85%;"
* [[inheritsFromControl]]: Returns true if the given object inherits from the Control class
+
! Function
* [[inheritsFromWinControl]]: Returns true if the given object inherits from the WinControl class
+
! Description
 +
|-
 +
| [[Lua:debugProcess|debugProcess]]
 +
| Starts debugging the currently attached process.
 +
|-
 +
| [[Lua:debug_setBreakpoint|debug_setBreakpoint]]
 +
| Sets a breakpoint of a specific size (in bytes) at the given address.
 +
|-
 +
| [[Lua:debug_removeBreakpoint|debug_removeBreakpoint]]
 +
| Removes a breakpoint at the specified address.
 +
|-
 +
| [[Lua:debug_continueFromBreakpoint|debug_continueFromBreakpoint]]
 +
| Resumes execution when the debugger is halted on a breakpoint.
 +
|-
 +
| [[Lua:debug_addThreadToNoBreakList|debug_addThreadToNoBreakList]]
 +
| Adds a thread to the no-break list so breakpoints on it will be ignored.
 +
|-
 +
| [[Lua:debug_removeThreadFromNoBreakList|debug_removeThreadFromNoBreakList]]
 +
| Removes a thread from the no-break list.
 +
|}
  
 +
==== Callbacks ====
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:debugger_onBreakpoint|debugger_onBreakpoint]]
 +
| User-defined callback invoked by CE when a breakpoint is hit (define your own implementation).
 +
|-
 +
| [[Lua:debugger_onModuleLoad|debugger_onModuleLoad]]
 +
| User-defined callback invoked by the Windows debugger when a module is loaded.
 +
|}
  
=== Assembly ===
+
==== Register and Context Management ====
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:debug_getContext|debug_getContext]]
 +
| Force-updates the Lua variables representing CPU registers from the current thread context. (CE 6.5+)
 +
|-
 +
| [[Lua:debug_setContext|debug_setContext]]
 +
| Force-updates the CPU registers from the Lua variables representing them. (CE 6.5+)
 +
|-
 +
| [[Lua:debug_updateGUI|debug_updateGUI]]
 +
| Refreshes the UI to reflect the current debug context if the debugger is broken.
 +
|-
 +
| [[Lua:debug_getXMMPointer|debug_getXMMPointer]]
 +
| Returns the memory address of the specified XMM register for the currently broken thread.
 +
|}
  
These functions help work with the x86 machine code as assembly.
+
==== Advanced Debugging ====
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:debug_setLastBranchRecording|debug_setLastBranchRecording]]
 +
| Tells the kernel-mode debugger to record the last few branch/jump instructions before a breakpoint is hit.
 +
|-
 +
| [[Lua:debug_getMaxLastBranchRecord|debug_getMaxLastBranchRecord]]
 +
| Returns the maximum number of branch records this CPU supports.
 +
|-
 +
| [[Lua:debug_getLastBranchRecord|debug_getLastBranchRecord]]
 +
| Returns the Last Branch Record value at the given index (when handling a breakpoint with branch recording enabled).
 +
|-
 +
| [[Lua:detachIfPossible|detachIfPossible]]
 +
| Detaches the debugger from the target process if possible.
 +
|}
  
* [[autoAssemble]]: Runs the auto assembler with the given text
+
=== DBK (Driver-Based Kernel) ===
* [[disassemble]]: Disassembles the given address and returns a string in the format of "address - bytes - opcode  extra"
+
Functions for kernel-mode operations via the DBK driver.
* [[splitDisassembledString]]: Returns 4 strings. The address, bytes, opcode and extra field
 
* [[getInstructionSize]]: Returns the size of an instruction
 
* [[getPreviousOpcode]]: Returns the address of the previous opcode (guess)
 
  
 +
==== Initialization and Setup ====
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:dbk_initialize|dbk_initialize]]
 +
| Loads and initializes the DBK kernel driver into memory if possible.
 +
|-
 +
| [[Lua:dbk_useKernelmodeOpenProcess|dbk_useKernelmodeOpenProcess]]
 +
| Redirects <code>OpenProcess</code> API calls to use kernel-mode DBK equivalents.
 +
|-
 +
| [[Lua:dbk_useKernelmodeProcessMemoryAccess|dbk_useKernelmodeProcessMemoryAccess]]
 +
| Redirects <code>ReadProcessMemory</code> and <code>WriteProcessMemory</code> to use kernel-mode DBK versions.
 +
|-
 +
| [[Lua:dbk_useKernelmodeQueryMemoryRegions|dbk_useKernelmodeQueryMemoryRegions]]
 +
| Redirects virtual memory query APIs to use kernel-mode DBK equivalents.
 +
|}
  
=== Debugger ===
+
==== Process and Thread Information ====
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:dbk_getPEProcess|dbk_getPEProcess]]
 +
| Returns the kernel pointer to the EPROCESS structure of the selected process ID.
 +
|-
 +
| [[Lua:dbk_getPEThread|dbk_getPEThread]]
 +
| Returns the kernel pointer to the ETHREAD structure of a given thread ID.
 +
|}
  
These functions manage the debugger. See ''[[Lua Debugging]]''.
+
==== CPU Register Access ====
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:dbk_readMSR|dbk_readMSR]]
 +
| Reads a Model-Specific Register (MSR) using the DBK driver.
 +
|-
 +
| [[Lua:dbk_writeMSR|dbk_writeMSR]]
 +
| Writes a Model-Specific Register (MSR) using the DBK driver.
 +
|-
 +
| [[Lua:dbk_getCR0|dbk_getCR0]]
 +
| Returns the value of Control Register 0 (CR0).
 +
|-
 +
| [[Lua:dbk_getCR3|dbk_getCR3]]
 +
| Returns the value of Control Register 3 (CR3) for the currently opened process.
 +
|-
 +
| [[Lua:dbk_getCR4|dbk_getCR4]]
 +
| Returns the value of Control Register 4 (CR4).
 +
|}
  
* [[debugProcess]]: Debugs the currently attached process
+
==== Memory and Execution ====
* [[debug_setBreakpoint]]: Sets a breakpoint of a specific size at the given address
+
{| class="wikitable" style="width:85%;"
* [[debugger_onBreakpoint]]: Called by CE when a breakpoint hits (userdefined)
+
! Function
* [[debug_removeBreakpoint]]: Removes a breakpoint
+
! Description
* [[debug_continueFromBreakpoint]]: Continues the debugger when it's halted on a breakpoint
+
|-
* [[debug_setLastBranchRecording]]: Tells the kernelmode debugger to record the last few branches before the breakpoint got hit
+
| [[Lua:dbk_getPhysicalAddress|dbk_getPhysicalAddress]]
* [[debug_getMaxLastBranchRecord]]: Returns the maximum number of branch records this cpu supports
+
| Converts a virtual address to its physical address using the DBK driver.
* [[debug_getLastBranchRecord]]: Returns the value of the Last Branch Record at the given index (when handling a breakpoint)
+
|-
* [[debugger_onModuleLoad]]: Called by CE when the windows debugger interface loads a module (userdefined)
+
| [[Lua:dbk_executeKernelMemory|dbk_executeKernelMemory]]
* [[getAutoAttachList]]: Returns the AutoAttach StringList object
+
| Executes a routine from kernel mode (e.g. injected code written with Auto Assembler).
* [[debug_getContext]] (since 6.5): Force-update the Lua variables representing the registers?
+
|-
* [[debug_setContext]] (since 6.5[http://www.cheatengine.org/forum/viewtopic.php?p=5639331&sid=755d2d512f48af1f29382048087761b9#5639331]): Force-update the registers to the Lua variables which represent them?
+
| [[Lua:dbk_writesIgnoreWriteProtection|dbk_writesIgnoreWriteProtection]]
 +
| When set to <code>true</code>, write operations bypass copy-on-write behavior.
 +
|}
  
=== DBK ===
+
=== DBVM ===
 +
Functions for hypervisor-based operations and advanced memory monitoring via DBVM.
  
* [[dbk_initialize]]: Loads the DBK driver into memory if possible
+
==== Initialization ====
* [[dbk_useKernelmodeOpenProcess]]: Switches the internal pointer of the OpenProcess api to dbk_OpenProcess
+
{| class="wikitable" style="width:85%;"
* [[dbk_useKernelmodeProcessMemoryAccess]]: Switches the internal pointer to the ReadProcessMemory and WriteProcessMemory apis to dbk_ReadProcessMemory and dbk_WriteProcessMemory
+
! Function
* [[dbk_useKernelmodeQueryMemoryRegions]]: Switches the internal pointer to the QueryVirtualMemory api to dbk_QueryVirtualMemory
+
! Description
* [[dbk_getPEProcess]]: Returns the pointer of the EProcess structure of the selected processid
+
|-
* [[dbk_getPEThread]]: Gets the pointer to the EThread structure of a threadid
+
| [[Lua:dbvm_initialize|dbvm_initialize]]
* [[dbk_readMSR]]: Reads the msr using the dbk driver
+
| Initializes the DBVM hypervisor functions for use.
* [[dbk_writeMSR]]: Writes the msr using the dbk driver
+
|}
* [[dbk_executeKernelMemory]]: Executes a routine from kernelmode (e.g a routine written there with auto assembler)
 
  
 +
==== Memory Operations ====
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:dbvm_addMemory|dbvm_addMemory]]
 +
| Adds a memory region to DBVM.
 +
|-
 +
| [[Lua:dbvm_readPhysicalMemory|dbvm_readPhysicalMemory]]
 +
| Reads physical memory directly using DBVM (hypervisor-level access).
 +
|-
 +
| [[Lua:dbvm_writePhysicalMemory|dbvm_writePhysicalMemory]]
 +
| Writes physical memory directly using DBVM (hypervisor-level access).
 +
|}
  
* [[dbvm_initialize]]: Initializes the dbvm functions
+
==== MSR and Control Register Access ====
* [[dbvm_readMSR]]: Reads the msr using dbvm (bypasses the driver)
+
{| class="wikitable" style="width:85%;"
* [[dbvm_writeMSR]]: Writes the msr using dbvm (bypasses the driver)
+
! Function
 +
! Description
 +
|-
 +
| [[Lua:dbvm_readMSR|dbvm_readMSR]]
 +
| Reads a Model-Specific Register (MSR) using DBVM (bypasses driver).
 +
|-
 +
| [[Lua:dbvm_writeMSR|dbvm_writeMSR]]
 +
| Writes a Model-Specific Register (MSR) using DBVM (bypasses driver).
 +
|-
 +
| [[Lua:dbvm_getCR4|dbvm_getCR4]]
 +
| Returns the real (unhooked) value of Control Register 4 (CR4).
 +
|}
  
 +
==== Memory Monitoring ====
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:dbvm_watch_writes|dbvm_watch_writes]]
 +
| Starts monitoring write accesses to a memory region.
 +
|-
 +
| [[Lua:dbvm_watch_reads|dbvm_watch_reads]]
 +
| Starts monitoring read accesses to a memory region.
 +
|-
 +
| [[Lua:dbvm_watch_retrievelog|dbvm_watch_retrievelog]]
 +
| Retrieves the log/results of memory region monitoring (reads or writes).
 +
|-
 +
| [[Lua:dbvm_watch_disable|dbvm_watch_disable]]
 +
| Stops memory region monitoring.
 +
|}
  
=== Miscellaneous ===
+
==== Memory Cloaking ====
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:dbvm_cloak_activate|dbvm_cloak_activate]]
 +
| Cloaks a memory page so modifications become invisible to the target process.
 +
|-
 +
| [[Lua:dbvm_cloak_deactivate|dbvm_cloak_deactivate]]
 +
| Disables cloaking on a page and undoes hidden modifications.
 +
|-
 +
| [[Lua:dbvm_cloak_readOriginal|dbvm_cloak_readOriginal]]
 +
| Reads the original (hidden) memory contents of a cloaked region.
 +
|-
 +
| [[Lua:dbvm_cloak_writeOriginal|dbvm_cloak_writeOriginal]]
 +
| Writes to the original (hidden) memory contents of a cloaked region.
 +
|}
  
* [[getPixel]]: Returns the rgb value of the pixel at the specific screen coordinate
+
==== Breakpoints and Debugging ====
* [[injectDll]]: Injects a dll
+
{| class="wikitable" style="width:85%;"
* [[allocateSharedMemory]]: Creates/reuses a shared memory object.
+
! Function
* [[createProcess]]: Creates a process with or without debugging
+
! Description
* [[shellExecute]]: Executes a given command
+
|-
* [[generateAPIHookScript]]: Generates an auto assembler script which will hook the given address when executed
+
| [[Lua:dbvm_changeregonbp|dbvm_changeregonbp]]
* [[onAPIPointerChange]]: Registers a callback when an api pointer is changed
+
| Cloaks a page, sets a breakpoint at the given address, and modifies registers when the breakpoint is hit.
* [[setAPIPointer]]: Sets the pointer of the given api to the given address
+
|-
 +
| [[Lua:dbvm_removechangeregonbp|dbvm_removechangeregonbp]]
 +
| Removes a "change registers on breakpoint" breakpoint.
 +
|}
  
 +
==== CR3 (Process Context) Logging ====
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:dbvm_log_cr3_start|dbvm_log_cr3_start]]
 +
| Starts logging all CR3 (process context/page directory) changes.
 +
|-
 +
| [[Lua:dbvm_log_cr3_stop|dbvm_log_cr3_stop]]
 +
| Stops CR3 logging.
 +
|}
  
Other various Cheat Engine internal objects.
+
==== Performance and Anti-Detection ====
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:dbvm_speedhack_setSpeed|dbvm_speedhack_setSpeed]]
 +
| Sets system-wide speed hack via DBVM (affects all processes).
 +
|-
 +
| [[Lua:dbvm_setTSCAdjust|dbvm_setTSCAdjust]]
 +
| Configures TSC (Time Stamp Counter) adjustment to bypass VM detection (RDTSC hooks).
 +
|}
  
* [[getFormCount]]: Returns the total number of forms assigned to the main CE application
+
=== Translation ===
* [[getForm]]: Returns the form at the specific index
+
{| class="wikitable" style="width:85%;"
* [[getMemoryViewForm]]: Returns the first Memoryview form class object
+
! Function
* [[getMainForm]]: Returns the first Mainform class object
+
! Description
* [[getFreezeTimer]]: Returns the Timer object responsible for freezing values
+
|-
* [[getUpdateTimer]]: Returns the Timer object responsible for updating the value list
+
| [[Lua:getTranslationFolder|getTranslationFolder]]
* [[getCommonModuleList]]: Returns the commonModuleList StringList object
+
| Returns the path to the current translation files. Returns an empty string if no translation is active.
 +
|-
 +
| [[Lua:loadPOFile|loadPOFile]]
 +
| Loads a ".PO" translation file into Cheat Engine's translation system.
 +
|-
 +
| [[Lua:translate|translate]]
 +
| Returns the translated text for a given source string. If no translation is found, returns the original string.
 +
|-
 +
| [[Lua:translateID|translateID]]
 +
| Returns the translation for a specific string ID (lookup by numerical or symbolic ID).
 +
|}
  
 +
=== Files ===
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:getFileVersion|getFileVersion]]
 +
| 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>.
 +
|-
 +
| [[Lua:getFileList|getFileList]]
 +
| Returns an indexed table (array) of filenames in the specified directory.
 +
|-
 +
| [[Lua:getDirectoryList|getDirectoryList]]
 +
| Returns an indexed table (array) of subdirectory names in the specified directory.
 +
|}
  
 +
=== Structures ===
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:registerStructureDissectOverride|registerStructureDissectOverride]]
 +
| 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.
 +
|-
 +
| [[Lua:unregisterStructureDissectOverride|unregisterStructureDissectOverride]]
 +
| Unregisters a previously registered structure dissect auto-guess override.
 +
|-
 +
| [[Lua:registerStructureNameLookup|registerStructureNameLookup]]
 +
| Registers a function that will be called when the structure dissect UI requests a name for a newly detected structure definition.
 +
|-
 +
| [[Lua:unregisterStructureNameLookup|unregisterStructureNameLookup]]
 +
| Unregisters a previously registered structure name lookup callback.
 +
|}
  
Besides the above functions, Cheat Engine also implements some classes.
+
=== Miscellaneous ===
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:injectDll|injectDll]]
 +
| Injects a DLL into the currently opened process.
 +
|-
 +
| [[Lua:shellExecute|shellExecute]]
 +
| Executes a given command or opens a file/URL using the system shell.
 +
|-
 +
| [[Lua:executeCode|executeCode]]
 +
| Executes a stdcall function at a given address in the target process with one parameter and waits for it to return.
 +
|-
 +
| [[Lua:executeCodeEx|executeCodeEx]]
 +
| Extended version of <code>executeCode</code> (supports more parameters/options).
 +
|-
 +
| [[Lua:executeCodeLocal|executeCodeLocal]]
 +
| Executes a stdcall function at a given address in Cheat Engine's own process (local execution).
 +
|-
 +
| [[Lua:executeCodeLocalEx|executeCodeLocalEx]]
 +
| Extended version of <code>executeCodeLocal</code> with additional options.
 +
|-
 +
| [[Lua:onAPIPointerChange|onAPIPointerChange]]
 +
| Registers a callback invoked when an API pointer is changed (allows reacting to API remapping).
 +
|-
 +
| [[Lua:setAPIPointer|setAPIPointer]]
 +
| Sets the pointer/address used for a specified API function.
 +
|-
 +
| [[Lua:md5memory|md5memory]]
 +
| Computes and returns the MD5 checksum (hex string) of the bytes at the provided memory address/size.
 +
|-
 +
| [[Lua:md5file|md5file]]
 +
| Computes and returns the MD5 checksum (hex string) of a file's contents.
 +
|-
 +
| [[Lua:getSystemMetrics|getSystemMetrics]]
 +
| Retrieves the specified system metric or configuration setting. See: [https://msdn.microsoft.com/en-us/library/windows/desktop/ms724385.aspx MSDN documentation].
 +
|-
 +
| [[Lua:getTickCount|getTickCount]]
 +
| Returns the tick count in milliseconds since the system started.
 +
|-
 +
| [[Lua:getUserRegistryEnvironmentVariable|getUserRegistryEnvironmentVariable]]
 +
| Reads an environment variable stored in the current user's registry environment.
 +
|-
 +
| [[Lua:setUserRegistryEnvironmentVariable|setUserRegistryEnvironmentVariable]]
 +
| Writes an environment variable to the current user's registry environment.
 +
|-
 +
| [[Lua:broadcastEnvironmentUpdate|broadcastEnvironmentUpdate]]
 +
| Broadcasts a notification that environment variables were changed (call after setting registry variables).
 +
|-
 +
| [[Lua:getApplication|getApplication]]
 +
| Returns the application object (main application/titlebar context).
 +
|-
 +
| [[Lua:getInternet|getInternet]]
 +
| Returns an Internet client class object. The provided string specifies the client name/type.
 +
|}
  
 
== Classes ==
 
== Classes ==
 +
A compact list of notable classes implemented by Cheat Engine.
 +
{| class="wikitable" style="width:100%;"
 +
! Class
 +
! Short description
 +
|-
 +
| [[Lua:Class:Addresslist|Addresslist]]
 +
| Container for memory records in a cheat table.
 +
|-
 +
| [[Lua:Class:Bitmap|Bitmap]]
 +
| Bitmap graphic object for drawing images.
 +
|-
 +
| [[Lua:Class:Brush|Brush]]
 +
| Brush used by a Canvas to fill areas.
 +
|-
 +
| [[Lua:Class:Button|Button]]
 +
| Visual button component.
 +
|-
 +
| [[Lua:Class:ButtonControl|ButtonControl]]
 +
| Base class common to button-like controls.
 +
|-
 +
| [[Lua:Class:Canvas|Canvas]]
 +
| Drawing surface used in paint events for lines, text, and images.
 +
|-
 +
| [[Lua:Class:Calendar|Calendar]]
 +
| Calendar/date-picker UI control.
 +
|-
 +
| [[Lua:Class:CEForm|CEForm]]
 +
| Cheat Engine main/form window class.
 +
|-
 +
| [[Lua:Class:CheatComponent|CheatComponent]]
 +
| Component used in Cheat Engine 5.x trainers.
 +
|-
 +
| [[Lua:Class:CheckBox|CheckBox]]
 +
| Checkbox UI control supporting checked/unchecked/indeterminate states.
 +
|-
 +
| [[Lua:Class:Component|Component]]
 +
| Base class for owner-managed components.
 +
|-
 +
| [[Lua:Class:Control|Control]]
 +
| Base class for visible UI controls.
 +
|-
 +
| [[Lua:Class:Collection|Collection]]
 +
| Abstract collection class (used by ListColumns and similar).
 +
|-
 +
| [[Lua:Class:CollectionItem|CollectionItem]]
 +
| Item managed by a Collection.
 +
|-
 +
| [[Lua:Class:ComboBox|ComboBox]]
 +
| Edit field with an attached dropdown ListBox.
 +
|-
 +
| [[Lua:Class:CriticalSection|CriticalSection]]
 +
| Synchronization primitive for thread-safe access.
 +
|-
 +
| [[Lua:Class:CustomControl|CustomControl]]
 +
| Base class for windowed controls that handle their own painting.
 +
|-
 +
| [[Lua:Class:CustomType|CustomType]]
 +
| Custom data-type converter for interpreting raw memory.
 +
|-
 +
| [[Lua:Class:D3DHOOK|D3DHOOK]]
 +
| D3D hook helper for rendering overlays in DirectX 9/10/11 games.
 +
|-
 +
| [[Lua:Class:D3DHook_FontMap|D3DHook_FontMap]]
 +
| Font texture map used by D3D hook rendering.
 +
|-
 +
| [[Lua:Class:D3DHook_Texture|D3DHook_Texture]]
 +
| Texture management for D3D hook sprites.
 +
|-
 +
| [[Lua:Class:D3Dhook_TextContainer|D3Dhook_TextContainer]]
 +
| Text container used to draw text via D3D hook.
 +
|-
 +
| [[Lua:Class:D3DHook_RenderObject|D3DHook_RenderObject]]
 +
| Abstract render object controlling rendering behavior.
 +
|-
 +
| [[Lua:Class:D3DHook_Sprite|D3DHook_Sprite]]
 +
| Rendered sprite/texture displayed via D3D hook.
 +
|-
 +
| [[Lua:Class:Disassembler|Disassembler]]
 +
| Disassembler helper class.
 +
|-
 +
| [[Lua:Class:Disassemblerview|Disassemblerview]]
 +
| Visual disassembler UI used in Memory View.
 +
|-
 +
| [[Lua:Class:DisassemblerviewLine|DisassemblerviewLine]]
 +
| Single line entry in a disassembler view.
 +
|-
 +
| [[Lua:Class:DissectCode|DissectCode]]
 +
| Structure dissection helper.
 +
|-
 +
| [[Lua:Class:Edit|Edit]]
 +
| Single-line text edit control.
 +
|-
 +
| [[Lua:Class:Event|Event]]
 +
| Event wrapper class for callbacks.
 +
|-
 +
| [[Lua:Class:FileStream|FileStream]]
 +
| Stream class for file-based I/O.
 +
|-
 +
| [[Lua:Class:FileDialog|FileDialog]]
 +
| Standard file selection dialog wrapper.
 +
|-
 +
| [[Lua:Class:FindDialog|FindDialog]]
 +
| Search/find dialog class.
 +
|-
 +
| [[Lua:Class:Font|Font]]
 +
| Font definition and metrics class.
 +
|-
 +
| [[Lua:Class:Form|Form]]
 +
| Window/form class.
 +
|-
 +
| [[Lua:Class:FoundList|FoundList]]
 +
| Companion class for MemScan results; reads result files.
 +
|-
 +
| [[Lua:Class:GenericHotkey|GenericHotkey]]
 +
| Register hotkeys with CE's hotkey handler.
 +
|-
 +
| [[Lua:Class:Graphic|Graphic]]
 +
| Abstract base for image/graphic classes.
 +
|-
 +
| [[Lua:Class:GraphicControl|GraphicControl]]
 +
| Lightweight control for simple graphics.
 +
|-
 +
| [[Lua:Class:GroupBox|GroupBox]]
 +
| Panel-like container with a header.
 +
|-
 +
| [[Lua:Class:Hexadecimal|Hexadecimal]]
 +
| Hex display helper used by Memory View.
 +
|-
 +
| [[Lua:Class:Hexadecimalview|Hexadecimalview]]
 +
| Hex display UI component in the Memory View.
 +
|-
 +
| [[Lua:Class:Icon|Icon]]
 +
| Icon resource wrapper.
 +
|-
 +
| [[Lua:Class:Image|Image]]
 +
| Image control for displaying pictures.
 +
|-
 +
| [[Lua:Class:Internet|Internet]]
 +
| Internet client helper class.
 +
|-
 +
| [[Lua:Class:JpegImage|JpegImage]]
 +
| JPEG image handler class.
 +
|-
 +
| [[Lua:Class:Label|Label]]
 +
| Static text label control.
 +
|-
 +
| [[Lua:Class:LuaPipe|LuaPipe]]
 +
| Abstract pipe communication class.
 +
|-
 +
| [[Lua:Class:LuaPipeClient|LuaPipeClient]]
 +
| Client implementation for pipe communication.
 +
|-
 +
| [[Lua:Class:LuaPipeServer|LuaPipeServer]]
 +
| Server implementation for pipe communication.
 +
|-
 +
| [[Lua:Class:ListBox|ListBox]]
 +
| List box control with selectable strings.
 +
|-
 +
| [[Lua:Class:ListColumn|ListColumn]]
 +
| Column descriptor for a ListView.
 +
|-
 +
| [[Lua:Class:ListColumns|ListColumns]]
 +
| Container for ListColumn objects.
 +
|-
 +
| [[Lua:Class:ListItem|ListItem]]
 +
| Entry in a ListView.
 +
|-
 +
| [[Lua:Class:ListItems|ListItems]]
 +
| Container for ListItem objects.
 +
|-
 +
| [[Lua:Class:Listview|Listview]]
 +
| Multi-column list view control.
 +
|-
 +
| [[Lua:Class:MainMenu|MainMenu]]
 +
| Top-level menu bar for a form.
 +
|-
 +
| [[Lua:Class:Memo|Memo]]
 +
| Multi-line text editor control.
 +
|-
 +
| [[Lua:Class:MemScan|MemScan]]
 +
| Memory scanner class for performing scans.
 +
|-
 +
| [[Lua:Class:Menu|Menu]]
 +
| Common ancestor for menu-related classes.
 +
|-
 +
| [[Lua:Class:MenuItem|MenuItem]]
 +
| Menu item descriptor.
 +
|-
 +
| [[Lua:Class:MemoryRecord|MemoryRecord]]
 +
| Cheat table entry describing an address/value/hotkey etc.
 +
|-
 +
| [[Lua:Class:MemoryRecordHotkey|MemoryRecordHotkey]]
 +
| Hotkey interface for a MemoryRecord.
 +
|-
 +
| [[Lua:Class:MemoryStream|MemoryStream]]
 +
| In-memory stream class.
 +
|-
 +
| [[Lua:Class:Memoryview|Memoryview]]
 +
| Memory view (hex editor) window class.
 +
|-
 +
| [[Lua:Class:MultiReadExclusiveWriteSynchronizer|MultiReadExclusiveWriteSynchronizer]]
 +
| Synchronizer for safe concurrent read/write access.
 +
|-
 +
| [[Lua:Class:Object|Object]]
 +
| Root base class for most CE classes.
 +
|-
 +
| [[Lua:Class:PaintBox|PaintBox]]
 +
| Control for custom painting surface.
 +
|-
 +
| [[Lua:Class:PageControl|PageControl]]
 +
| Container for multiple pages/tabs.
 +
|-
 +
| [[Lua:Class:Panel|Panel]]
 +
| Container control for grouping child controls.
 +
|-
 +
| [[Lua:Class:Pen|Pen]]
 +
| Drawing pen used by Canvas for lines.
 +
|-
 +
| [[Lua:Class:Picture|Picture]]
 +
| Container for Graphic objects.
 +
|-
 +
| [[Lua:Class:PopupMenu|PopupMenu]]
 +
| Context (right-click) menu class.
 +
|-
 +
| [[Lua:Class:PortableNetworkGraphic|PortableNetworkGraphic]]
 +
| PNG image class.
 +
|-
 +
| [[Lua:Class:ProgressBar|ProgressBar]]
 +
| Visual progress indicator control.
 +
|-
 +
| [[Lua:Class:RadioGroup|RadioGroup]]
 +
| Group of radio-button controls.
 +
|-
 +
| [[Lua:Class:RasterImage|RasterImage]]
 +
| Base class for raster image controls.
 +
|-
 +
| [[Lua:Class:RIPRelativeScanner|RIPRelativeScanner]]
 +
| Helper for RIP-relative instruction scanning.
 +
|-
 +
| [[Lua:Class:OpenDialog|OpenDialog]]
 +
| File open dialog class.
 +
|-
 +
| [[Lua:Class:SaveDialog|SaveDialog]]
 +
| File save dialog class.
 +
|-
 +
| [[Lua:Class:SelectDirectoryDialog|SelectDirectoryDialog]]
 +
| Directory selection dialog class.
 +
|-
 +
| [[Lua:Class:Semaphore|Semaphore]]
 +
| Semaphore synchronization primitive.
 +
|-
 +
| [[Lua:Class:Settings|Settings]]
 +
| Access and modify Cheat Engine settings and store plugin data.
 +
|-
 +
| [[Lua:Class:Splitter|Splitter]]
 +
| UI splitter control for resizing panels.
 +
|-
 +
| [[Lua:Class:Stringlist|Stringlist]]
 +
| Ordered list container for strings.
 +
|-
 +
| [[Lua:Class:Strings|Strings]]
 +
| Abstract base for text collections.
 +
|-
 +
| [[Lua:Class:StringStream|StringStream]]
 +
| Stream wrapper around a string buffer.
 +
|-
 +
| [[Lua:Class:Structure|Structure]]
 +
| Structure definition class for memory layouts.
 +
|-
 +
| [[Lua:Class:StructureElement|StructureElement]]
 +
| Single element inside a Structure.
 +
|-
 +
| [[Lua:Class:StructureFrm|StructureFrm]]
 +
| Structure editor/dissector form class.
 +
|-
 +
| [[Lua:Class:structGroup|structGroup]]
 +
| Grouping helper for structure elements.
 +
|-
 +
| [[Lua:Class:SymbolList|SymbolList]]
 +
| Symbol lookup class (address ↔ name).
 +
|-
 +
| [[Lua:Class:TabSheet|TabSheet]]
 +
| Single page within a PageControl.
 +
|-
 +
| [[Lua:Class:TableFile|TableFile]]
 +
| Represents a file stored inside a cheat table.
 +
|-
 +
| [[Lua:Class:Thread|Thread]]
 +
| Thread wrapper class.
 +
|-
 +
| [[Lua:Class:Timer|Timer]]
 +
| Non-visual timer component triggering onTimer events.
 +
|-
 +
| [[Lua:Class:ToggleBox|ToggleBox]]
 +
| Toggleable button-like control.
 +
|-
 +
| [[Lua:Class:TrackBar|TrackBar]]
 +
| Slider control for numeric values.
 +
|-
 +
| [[Lua:Class:TreeNode|TreeNode]]
 +
| Node in a Treeview.
 +
|-
 +
| [[Lua:Class:TreeNodes|TreeNodes]]
 +
| Container for TreeNode objects.
 +
|-
 +
| [[Lua:Class:Treeview|Treeview]]
 +
| Tree view control.
 +
|-
 +
| [[Lua:Class:WinControl|WinControl]]
 +
| Base class for windowed controls.
 +
|-
 +
| [[Lua:Class:xmplayer|xmplayer]]
 +
| XM player class for tracker music playback.
 +
|}
 +
 +
=== SQL Classes ===
 +
{| class="wikitable" style="width:85%;"
 +
! Class
 +
! Short description
 +
|-
 +
| [[Lua:SQL:CustomConnection|CustomConnection]]
 +
| Base for custom DB connection implementations.
 +
|-
 +
| [[Lua:SQL:Database|Database]]
 +
| Database container/manager for connections and datasets.
 +
|-
 +
| [[Lua:SQL:SQLConnection|SQLConnection]]
 +
| Generic SQL connection abstraction.
 +
|-
 +
| [[Lua:SQL:SQLite3Connection|SQLite3Connection]]
 +
| SQLite3 connection implementation.
 +
|-
 +
| [[Lua:SQL:ODBCConnection|ODBCConnection]]
 +
| ODBC data source connection.
 +
|-
 +
| [[Lua:SQL:DBTransaction|DBTransaction]]
 +
| Transaction object for DB operations.
 +
|-
 +
| [[Lua:SQL:SQLTransaction|SQLTransaction]]
 +
| SQL-specific transaction object.
 +
|-
 +
| [[Lua:SQL:Param|Param]]
 +
| Single query parameter object.
 +
|-
 +
| [[Lua:SQL:Params|Params]]
 +
| Parameter container for queries.
 +
|-
 +
| [[Lua:SQL:Fields|Fields]]
 +
| Field metadata and values container.
 +
|-
 +
| [[Lua:SQL:Dataset|Dataset]]
 +
| Abstract dataset representing query results.
 +
|-
 +
| [[Lua:SQL:DBDataset|DBDataset]]
 +
| Database-backed dataset implementation.
 +
|-
 +
| [[Lua:SQL:CustomBufDataset|CustomBufDataset]]
 +
| In-memory buffered dataset.
 +
|-
 +
| [[Lua:SQL:CustomSQLQuery|CustomSQLQuery]]
 +
| Extended/custom SQL query object.
 +
|-
 +
| [[Lua:SQL:SQLQuery|SQLQuery]]
 +
| Standard SQL query executor and result-holder.
 +
|}
  
* [[Addresslist]]: The addresslist class is a container for memory records
+
=== Class Helper Functions ===
* [[Brush]]: The brush class is part of the Canvas object. It's used to fill surfaces
+
{| class="wikitable" style="width:85%;"
* [[Button]]: The button class is a visual component in the shape of a button.
+
! Function
* [[ButtonControl]]: Common ancestor of several button like objects.
+
! Description
* [[Canvas]]: 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
+
|-
* [[CheatComponent]]: The cheatcomponent class is the component used in Cheat Engine 5.x trainers
+
| [[Lua:inheritsFromObject|inheritsFromObject]]
* [[CheckBox]]: The Checkbox is a visual component that lets the user click it and change state between checked, unchecked, and if possible, grayed
+
| Returns <code>true</code> if the given object/class inherits from <code>Object</code>.
* [[Component]] : Base class for all components that need owner-owned functionality.
+
|-
* [[Control]] : Base class for visible controls.
+
| [[Lua:inheritsFromComponent|inheritsFromComponent]]
* [[Collection]]: The Collection class is an abstract class that the ListColumns class implements (And perhaps other classes as well)
+
| Returns <code>true</code> if the object/class inherits from <code>Component</code>.
* [[CollectionItem]]:  Basic object that is managed by a Collection class
+
|-
* [[ComboBox]]: The Combobox is like an edit field with a ListBox attached to it
+
| [[Lua:inheritsFromControl|inheritsFromControl]]
* [[CustomControl]]: Base class for windowed controls which paint themselves
+
| Returns <code>true</code> if the object/class inherits from <code>Control</code>.
* [[Disassemblerview]]: The visual disassembler used in the memory view window
+
|-
* [[Edit]]: The Edit class is a visual component that lets the user type in data (Use control_getCaption to get the user input)
+
| [[Lua:inheritsFromWinControl|inheritsFromWinControl]]
* [[FileStream]]: The FileStream class is a Stream class that is linked to an open file on disk
+
| Returns <code>true</code> if the object/class inherits from <code>WinControl</code>.
* [[Font]]: Class that defines a font
+
|-
* [[Form]]: Class that defines a window
+
| [[Lua:createClass|createClass]]
* [[FoundList]]: The foundlist is an companion class to MemScan. It opens the current memscan's result file and provides an interface for reading out the addresses
+
| Creates an instance of the specified registered class (default constructor).
* [[GenericHotkey]]: Lets you register hotkeys to Cheat Engine's internal hotkey handler
+
|-
* [[Graphic]]: Base class for dealing with Graphic images (Abstract)
+
| [[Lua:createComponentClass|createComponentClass]]
* [[GraphicControl]]: Class that supports simple lightweight controls that do not need the ability to accept keyboard input or contain other controls.
+
| Creates an instance of the specified component class (owner/parent may be required).
* [[GroupBox]]: The groupbox class is like a Panel, but then has a header on top
+
|}
* [[Hexadecimalview]]: The visual hexadecimal object used on the memory view window
 
* [[Image]]: The Image class is a visual component that lets you show an image
 
* [[Label]]: The Label class is a visual component that lets you display text
 
* [[ListBox]]: The listbox class is a visual component with a list of selectable strings
 
* [[ListColumn]]: The listcolumn class is an implemented CollectionItem class which is used by the ListColumns class of the listview class
 
* [[ListColumns]]: The ListColumns class contains the Column class objects of a ListView object
 
* [[ListItem]]: The ListItem class object is an entry in a ListView
 
* [[ListItems]]: The listItems class is a container for the ListItem class objects of a Listview
 
* [[Listview]]: The listview class lets you have a listbox like component with resizable columns
 
* [[MainMenu]]: The menu at the top of a form
 
* [[Memo]]: The Memo class is a multiline edit field
 
* [[MemScan]]: The memscan class is the memory scanner of Cheat engine
 
* [[Menu]]: Common Class ancestor for the MainMenu and PopupMenu classes
 
* [[MenuItem]]: Holds the menuitems of a Menu, PopupMenu or even another MenuItem
 
* [[MemoryRecord]]: The Memoryrecord class object describes a Cheat Table's Cheat Entry.
 
* [[MemoryRecordHotkey]]: The memoryRecordHotkey class object is part of a MemoryRecord class. It's used as an interface to each individual hotkey inside a Cheat Table
 
* [[MemoryStream]]: 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
 
* [[Memoryview]]: The memoryview class is the Memory view window of Cheat Engine. Use this as a basis to access the objects inside this window
 
* [[Object]] : Most basic class. All classes inherit from this class
 
* [[Panel]]: The Panel class is like a form which can contain visual components.
 
* [[Pen]]: The Pen class is part of the Canvas object. It's used to draw lines
 
* [[Picture]]: Container for the Graphic class
 
* [[PopupMenu]]: The menu that shows when rightclicking on an object
 
* [[ProgressBar]]: The progressbar class is a visual representation for a bar that can show the current progress on something
 
* [[RadioGroup]]: The radiogroup is like a GroupBox but autopopulated using the Items(Strings object)
 
* [[OpenDialog]]: The OpenDialog class is used for selecting files to open.
 
* [[SaveDialog]]: The SaveDialog class is based on the OpenDialog class but is used to select a file for saving
 
* [[Splitter]]: The Splitter class is a visual component that lets the user re-size neighboring components)
 
* [[Stringlist]]: Class that holds a list of strings
 
* [[Strings]]: Abstract class that some text based classes make use of
 
* [[TableFile]]: Tablefiles are files stored into a Cheat Table. You can access the data of such a file using this class
 
* [[Timer]]: The timer class is an non visual component that when active triggers an onTimer event every few milliseconds, based on the given interval
 
* [[ToggleBox]]: The togglebox is like a button, but can stay down. Use with the checkbox methods
 
* [[TrackBar]]: The trackbar class is a slider you can drag arround and read/set the state
 
* [[Wincontrol]]: Base class for controls which can contain other controls.
 
  
== Undefined Class Property Functions ==
+
=== Undefined Class Property Functions ===
 +
Not all class properties are explicitly exposed; these helpers allow dynamic access to published properties and method/event bindings.
  
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)
+
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:getPropertyList|getPropertyList]]
 +
| Returns a [[Lua:Class:StringList|StringList]] of published property names for the specified class.
 +
|-
 +
| [[Lua:setProperty|setProperty]]
 +
| Sets the value of a published property on an object instance (not usable for method properties).
 +
|-
 +
| [[Lua:getProperty|getProperty]]
 +
| Gets the value of a published property on an object instance (not usable for method properties).
 +
|-
 +
| [[Lua:setMethodProperty|setMethodProperty]]
 +
| Assigns a Lua function to a method/event property on an object.
 +
|-
 +
| [[Lua:getMethodProperty|getMethodProperty]]
 +
| Retrieves a callable wrapper to invoke the original method/property on the object.
 +
|}
  
See:
+
{{NeedWork}}
* [[getPropertyList]] : Returns a StringList object containing all the published properties of the specified class
 
* [[setProperty]] : Sets the value of a published property of a class (Won't work for method properties)
 
* [[getProperty]] : Gets the value of a published property of a class (Won't work for method properties)
 

Latest revision as of 15:30, 4 December 2025

Cheat Engine comes with an extensive set of Lua functions you can use inside cheat tables, trainers and standalone scripts.

Contents

Variables[edit]

Globals[edit]

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

CPU / Debug Variables (Registers)[edit]

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]

Cheat Table[edit]

These functions help manage the cheat table and its files.

Function Description
getAddressList Returns the cheat table Addresslist object.
findTableFile Returns a TableFile stored in the cheat table (search by filename or identifier).
createTableFile Adds a new file entry to the cheat table.
loadTable Loads a ".ct" or ".cetrainer" file or stream into the cheat table.
saveTable Saves the current cheat table to disk.

Trainers[edit]

Functions related to the trainer (.exe) generator.

Function Description
registerEXETrainerFeature Adds a new feature to the EXE trainer generator window and calls your callback when a user builds a .exe trainer.
unregisterEXETrainerFeature Unregisters a previously registered trainer feature.

Protection[edit]

Functions for protecting Cheat Engine or encoding code.

Function Description
activateProtection Prevents basic memory scanners from opening or inspecting the Cheat Engine process.
enableDRM Enables kernel-mode protections or DRM measures to prevent normal memory scanners from reading the Cheat Engine process.
encodeFunction Encodes a given Lua function to a string that can be stored/transferred; can be decoded later with decodeFunction.
decodeFunction Decodes an encoded function string back into a callable Lua function.

Scanning[edit]

Functions that control and query memory scans.

Function Description
AOBScan Scans the currently opened process for an array-of-bytes (AOB) pattern and returns a StringList of all matches.
AOBScanModuleUnique Scans the process memory for a byte pattern and returns the address if exactly one unique match is found; returns nil otherwise.
AOBScanUnique Scans the entire process for a pattern and returns the address if exactly one unique match exists; returns nil otherwise.
getCurrentMemscan Returns the currently active scan session as a MemScan object.

Process[edit]

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

Function Description
createProcess Creates (and optionally debugs) a new process.
openProcess Opens a process given a process name or PID; attaches Cheat Engine to it for memory access.
onOpenProcess Callback invoked by Cheat Engine when it opens a process (user-defined handler).
getForegroundProcess Returns the process ID (PID) of the currently foreground (top) window process.
getOpenedProcessID Returns the PID of the currently opened/attached process.
getProcessIDFromProcessName Returns the PID for a given process name (if running).
openFileAsProcess Opens a file and treats it like a process (gives memory access similar to opening a process).
saveOpenedFile Saves changes made to the opened file.
setPointerSize 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.
setAssemblerMode Sets assembler bit mode: 0 = 32-bit, 1 = 64-bit.
getProcesslist Returns a system process list object.
getWindowlist Returns a list of top-level windows.
pause Pauses the currently opened process.
unpause Resumes the currently opened process.
targetIs64Bit Returns true if the target process is 64-bit, otherwise false.
enumModules Returns a table with information about each module in the current process (or a specified PID).
closeRemoteHandle Closes a remote handle to a process.

Threads[edit]

Function Description
getCPUCount Returns the number of CPU cores available on the system.
getThreadlist Fills a List object with the thread list of the currently opened process (returns thread IDs and basic info).
inMainThread Returns true if the current Lua code is running in the main thread (available in CE 6.4+); otherwise false.
synchronize 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.
queue Schedules the provided function to run in the main thread but does not wait for the result (fire-and-forget).
checkSynchronize Intended to be called from the main thread's loop to process pending synchronized calls when using threads and synchronize/queue.

Handles[edit]

Function Description
getHandleList 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.

Function Description
getAddress Returns the numeric address of a symbol (module+export, label, or CE symbol). Raises an error if the symbol cannot be resolved.
getAddressSafe Same as getAddress but returns nil if the symbol cannot be found (does not throw).
getNameFromAddress Returns the address formatted as a string, preferring symbol/module+offset notation when available.
registerSymbol Assigns the specified symbol name to an address (adds a user-defined symbol).
unregisterSymbol Removes a previously registered symbol mapping for an address.
getSymbolInfo Returns a table/object with symbol information (module name, search key, address, size), matching the SymbolList structure.
reinitializeSymbolhandler Reinitializes the symbol handler (useful after loading new modules).
inModule Returns true if the specified address lies inside a loaded module.
inSystemModule Returns true if the address is inside a system module (OS module), e.g., kernel or system DLLs.
getModuleSize Returns the size (in bytes) of the specified module. Use getAddress to retrieve the module base address first if needed.
errorOnLookupFailure Sets whether address/symbol lookups will throw errors on failure or return 0/nil depending on configuration.
registerSymbolLookupCallback Registers a callback function invoked when a symbol is parsed/loaded.
unregisterSymbolLookupCallback Unregisters a previously registered symbol lookup callback.
registerAddressLookupCallback Registers a callback called when an address-to-name conversion is requested.
unregisterAddressLookupCallback Unregisters the address lookup callback.
reinitializeDotNetSymbolhandler Reinitializes only the .NET portion of the symbol handler (useful when .NET modules change).

Memory[edit]

Function Description
allocateMemory Allocates executable/non-executable memory in the target process and returns the allocated address.
deAlloc Frees memory previously allocated in the target process.
allocateSharedMemory Creates or opens a named shared memory object of the given size for interprocess communication.
createSection Creates a memory section object (OS-specific) for sharing or mapping memory.
mapViewOfSection Maps a created section into the process address space, returning the mapped base address.
unMapViewOfSection Unmaps a previously mapped section view from the process address space.
copyMemory Copies memory from a source address to a destination address (can be used within target process or between processes depending on API).
allocateKernelMemory Allocates a block of nonpaged kernel memory (requires driver or appropriate privileges) and returns its address.
freeKernelMemory Frees kernel-mode memory previously allocated.
mapMemory Maps memory from one process context into another usermode context (maps a specified address from PID A into PID B's address space).
unmapMemory Unmaps memory previously mapped with mapMemory.
createMemoryStream Creates a memory stream object that can be used to read/write memory data conveniently from Lua.

Reading from Target Process[edit]

Function Description
readBytes Reads raw bytes at the given address. If ReturnAsTable is true, returns a table; otherwise returns multiple byte values.
readSmallInteger Reads a 16-bit (word) integer from the specified address. Optional second parameter: if true, reads as signed integer.
readInteger Reads a 32-bit (dword) integer from the specified address. Optional second parameter: if true, reads as signed integer.
readQword Reads a 64-bit (qword) integer from the specified address.
readPointer Reads a pointer-sized value: readQword on 64-bit targets, readInteger on 32-bit targets.
readFloat Reads a single-precision (32-bit) floating-point value from the specified address.
readDouble Reads a double-precision (64-bit) floating-point value from the specified address.
readString Reads a null-terminated string from memory up to maxlength bytes (prevents infinite loops on corrupted memory).
readRegionFromFile Reads a region from a file and writes it to a specific address in the target process.

Reading from Cheat Engine Memory[edit]

Function Description
readBytesLocal Same as readBytes, but reads from Cheat Engine's own memory.
readSmallIntegerLocal Reads a 16-bit integer from CE's memory. Optional: use signed if second parameter is true.
readIntegerLocal Reads a 32-bit integer from CE's memory. Optional: use signed if second parameter is true.
readQwordLocal Reads a 64-bit integer from CE's memory.
readPointerLocal Reads a pointer-sized value from CE's memory (64-bit or 32-bit depending on CE build).
readFloatLocal Reads a single-precision float from CE's memory.
readDoubleLocal Reads a double-precision float from CE's memory.
readStringLocal Reads a null-terminated string from CE's memory.

Writing to Target Process[edit]

Function Description
writeBytes Writes the given bytes (from a table) to the specified address in the target process.
writeSmallInteger Writes a 16-bit integer to the specified address. Returns true on success.
writeInteger Writes a 32-bit integer to the specified address. Returns true on success.
writeQword Writes a 64-bit integer to the specified address. Returns true on success.
writeFloat Writes a single-precision float to the specified address. Returns true on success.
writeDouble Writes a double-precision float to the specified address. Returns true on success.
writeString Writes a string to the specified address (typically null-terminated). Returns true on success.
writeRegionToFile Writes a memory region to a file. Returns the number of bytes written.

Writing to Cheat Engine Memory[edit]

Function Description
writeSmallIntegerLocal Writes a 16-bit integer to CE's memory. Returns true on success.
writeIntegerLocal Writes a 32-bit integer to CE's memory. Returns true on success.
writeQwordLocal Writes a 64-bit integer to CE's memory. Returns true on success.
writeFloatLocal Writes a single-precision float to CE's memory. Returns true on success.
writeDoubleLocal Writes a double-precision float to CE's memory. Returns true on success.
writeStringLocal Writes a string to CE's memory. Returns true on success.
writeBytesLocal Writes the given bytes (from a table) to CE's memory.

Conversions[edit]

Encoding/Decoding[edit]

Function Description
ansiToUtf8 Converts a string from ANSI encoding to UTF-8 encoding.
utf8ToAnsi Converts a string from UTF-8 encoding to ANSI encoding.
stringToMD5String Computes and returns the MD5 hash of a string as a hexadecimal string.
integerToUserData Converts a given integer to a userdata variable.
userDataToInteger Converts a given userdata variable back to an integer.

To Byte Table[edit]

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

Function Description
wordToByteTable Converts a 16-bit word to a byte table.
dwordToByteTable Converts a 32-bit dword to a byte table.
qwordToByteTable Converts a 64-bit qword to a byte table.
floatToByteTable Converts a single-precision float to a byte table.
doubleToByteTable Converts a double-precision float to a byte table.
stringToByteTable Converts a string (ANSI/UTF-8) to a byte table.
wideStringToByteTable 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.

Function Description
byteTableToWord Converts a byte table to a 16-bit word.
byteTableToDword Converts a byte table to a 32-bit dword.
byteTableToQword Converts a byte table to a 64-bit qword.
byteTableToFloat Converts a byte table to a single-precision float.
byteTableToDouble Converts a byte table to a double-precision float.
byteTableToString Converts a byte table to a string.
byteTableToWideString Converts a byte table to a wide string (Unicode).

Binary Operations[edit]

Bitwise operations on integers.

Function Description
bOr Bitwise OR operation.
bXor Bitwise XOR (exclusive OR) operation.
bAnd Bitwise AND operation.
bShl Bitwise shift left operation.
bShr Bitwise shift right operation.
bNot Bitwise NOT (complement) operation.

Input Devices[edit]

Keyboard & Mouse[edit]

Function Description
getMousePos Returns the current mouse cursor position as X and Y coordinates.
setMousePos Sets the mouse cursor position to the specified X and Y coordinates.
isKeyPressed Returns true if the specified key is currently held down.
keyDown Simulates pressing a key (puts the key into down state).
keyUp Simulates releasing a key (puts the key into up state).
doKeyPress Simulates a complete key press (down and up).
mouse_event Calls the Windows API mouse_event directly for advanced mouse control. See MSDN documentation.
setGlobalKeyPollInterval Sets the global key poll interval (frequency of keyboard state updates).
setGlobalDelayBetweenHotkeyActivation Sets the minimum delay (in milliseconds) between consecutive activations of the same hotkey.

Game Controller[edit]

XBox/game controller input.

Function Description
getXBox360ControllerState Fetches the current state (buttons, triggers, sticks) of a connected XBox 360 controller.
setXBox360ControllerVibration Sets the speed of the left and right vibration motors in an XBox 360 controller (for haptic feedback).

Clipboard[edit]

Function Description
writeToClipboard Writes the given text to the system clipboard.

Screen[edit]

Function Description
getScreenHeight Returns the height of the screen in pixels.
getScreenWidth Returns the width of the screen in pixels.
getScreenDPI Returns the screen DPI (dots per inch) for determining screen scaling/density.
getWorkAreaHeight Returns the height of the usable work area (excludes taskbars).
getWorkAreaWidth Returns the width of the usable work area (excludes taskbars).
getScreenCanvas Returns a Canvas object for drawing directly to the screen. Limited usefulness in practice due to performance constraints.
getPixel Returns the RGB color value of a pixel at the specified screen coordinates.

Sounds[edit]

General Audio[edit]

Function Description
playSound Plays an audio file (supports various formats like .wav, .mp3, etc.).
beep Plays a system beep/ping sound.

Text-to-Speech[edit]

Function Description
speak Speaks the given text using the system's text-to-speech engine and optional flags. See MSDN SpeakFlags.
speakEnglish 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.

Function Description
xmplayer_playXM Plays an XM audio file given its filename.
xmplayer_pause Pauses the currently playing XM audio file.
xmplayer_resume Resumes playback of a paused XM audio file.
xmplayer_stop Stops XM audio playback completely.
xmplayer_isPlaying Returns true if an XM audio file is currently being played.

Fonts[edit]

Function Description
loadFontFromStream Loads a font from a memory stream and returns a handle/ID for later use with unloadLoadedFont.
unloadLoadedFont Unloads a previously loaded font by its handle/ID, freeing resources.

Forms and Windows[edit]

Function Description
findWindow Finds a window by class name and/or window title/caption.
getWindow Gets a window handle based on a relative command (e.g. parent, child, next). See MSDN GetWindow.
getWindowCaption Returns the caption/title text of the specified window.
getWindowClassName Returns the class name of the specified window.
getWindowProcessID Returns the process ID (PID) of the process that owns the specified window.
getForegroundWindow Returns the handle of the topmost (foreground) window currently active.
sendMessage Sends a Windows message to the specified window.
hookWndProc Hooks a window's window procedure (WndProc) to intercept and handle messages.
unhookWndProc Uninstalls a WndProc hook previously installed via hookWndProc.

Cheat Engine[edit]

Functions for managing and controlling Cheat Engine itself.

Version and Information[edit]

Function Description
getCEVersion Returns the Cheat Engine version as a floating-point number (e.g. 7.5).
getCheatEngineFileVersion Returns full version information: a raw integer and a table containing major, minor, release, and build numbers.
cheatEngineIs64Bit Returns true if Cheat Engine is running as 64-bit; false if 32-bit.
getCheatEngineProcessID Returns the process ID of the Cheat Engine process itself.
getCheatEngineDir Returns the folder path where Cheat Engine (or the current trainer) is located.

Management[edit]

Function Description
closeCE Closes Cheat Engine.
getFreezeTimer Returns the Timer object responsible for freezing/unfreezing values in the address list.
getUpdateTimer Returns the Timer object responsible for updating displayed values in the address list.
getCommonModuleList Returns the common module list as a StringList object.
getAutoAttachList Returns the AutoAttach list as a StringList object.
connectToCEServer Connects to a remote Cheat Engine server (given host and port). Subsequent operations route through the server.
reloadSettingsFromRegistry Reloads Cheat Engine settings from the registry and applies them immediately.
loadPlugin Loads the specified plugin.
getSettings Returns the settings object for accessing/modifying CE configuration.
registerBinUtil Registers a binutils (assembler/disassembler) toolset with Cheat Engine.

Comments and Headers[edit]

Function Description
getComment Gets the user-defined comment attached to the specified address.
setComment Sets a user-defined comment at the specified address.
getHeader Gets the user-defined header text at the specified address.
setHeader Sets a user-defined header text at the specified address.

Advertising and Support[edit]

Function Description
supportCheatEngine Displays an advertising/support window to help fund Cheat Engine development.
fuckCheatEngine Hides/closes the advertising window if it was showing (crude but functional name).

Forms and UI[edit]

Function Description
getFormCount Returns the total number of forms currently attached to the main CE application.
getForm Returns the form object at the specified index (0-based).
getMemoryViewForm Returns the first MemoryView form object (the hex editor window).
getMainForm Returns the main Cheat Engine window form object.
getSettingsForm Returns the settings/options dialog form object.
getLuaEngine Returns the Lua engine/console form object (creates it if needed).
unhideMainCEwindow Shows the main Cheat Engine window (opposite of hideAllCEWindows).
hideAllCEWindows Hides all normal Cheat Engine windows (e.g. the trainer table UI).
registerFormAddNotification Registers a callback function invoked when a form is added to CE's form list.
unregisterFormAddNotification Unregisters a previously registered form add notification callback.

Messages[edit]

Function Description
showMessage Shows a simple message box with the given text to the user.
messageDialog Pops up a message dialog box (similar to showMessage, with more control over buttons/options).
outputDebugString Outputs a message using the Windows OutputDebugString API (visible in debuggers).
processMessages Processes pending window messages in the event queue, allowing button clicks and UI updates to be handled.

Input[edit]

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

Shortcuts[edit]

Function Description
shortCutToText Converts a shortcut integer value to its textual representation (e.g. "Ctrl+Alt+A"). (CE 6.4+)
textToShortCut Converts a text representation (e.g. "Ctrl+Alt+A") to a shortcut integer value. (CE 6.4+)
convertKeyComboToString Converts a key combination to its string representation, matching the hotkey handler's format.

Speed Hack[edit]

Function Description
speedhack_setSpeed Enables the speed hack (if not already active) and sets the game/process speed multiplier (e.g. 2.0 for 2x speed).
speedhack_getSpeed Returns the current speed hack multiplier value that was last set.

Lua[edit]

Functions for managing the Lua engine and state.

Function Description
resetLuaState Creates a fresh Lua state, resetting the environment and clearing all previously defined variables/functions.
sleep Pauses execution for the specified number of milliseconds.
createRef Creates and returns an integer reference handle that can store and retrieve Lua objects persistently.
getRef Retrieves the Lua value/object referenced by the given reference handle.
destroyRef Destroys and frees a reference handle, removing the reference and allowing garbage collection.

Types[edit]

Functions for registering and managing custom data types.

Function Description
onAutoGuess Registers a callback function invoked by Cheat Engine's auto-guess feature to predict and suggest variable types.
registerCustomTypeLua Registers a custom data type defined using Lua functions for reading/writing/display logic.
registerCustomTypeAutoAssembler Registers a custom data type defined using an Auto Assembler script.

Object-oriented[edit]

Functions for determining class inheritance and type relationships.

Function Description
inheritsFromObject Returns true if the given object is a valid Cheat Engine class instance (inherits from Object).
inheritsFromComponent Returns true if the given object inherits from the Component class.
inheritsFromControl Returns true if the given object inherits from the Control class (UI controls).
inheritsFromWinControl 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.

Function Description
autoAssemble Executes an Auto Assembler script (given as text) for code injection, patching, or other assembly operations.
autoAssembleCheck Validates an Auto Assembler script for syntax errors. Returns true on success; false with error message on failure.
disassemble Disassembles the instruction at the given address and returns a formatted string: "address - bytes - opcode extra".
splitDisassembledString Parses a disassembled instruction string and returns 4 separate strings: address, bytes, opcode, and extra field.
getInstructionSize Returns the size (in bytes) of the instruction at the given address.
getPreviousOpcode Attempts to find and return the address of the previous instruction (heuristic guess).
registerAssembler Registers a custom callback function for the single-line assembler to convert instruction mnemonics to bytes.
unregisterAssembler Unregisters a previously registered custom assembler callback.

Auto Assembler[edit]

Commands & Hooks[edit]

Function Description
registerAutoAssemblerCommand Registers a custom Auto Assembler command that calls the specified Lua function when invoked in a script.
unregisterAutoAssemblerCommand Unregisters a previously registered Auto Assembler command.
registerAutoAssemblerPrologue Registers a callback function invoked before the Auto Assembler parses a script (prologue phase).
unregisterAutoAssemblerPrologue Unregisters an Auto Assembler prologue callback.
fullAccess Changes memory protection on a block of memory to be writable and executable.

Scripts & Templates[edit]

Function Description
registerAutoAssemblerTemplate Registers a reusable template for the Auto Assembler script generator.
unregisterAutoAssemblerTemplate Unregisters a previously registered Auto Assembler template.
generateCodeInjectionScript Generates and appends a default code injection script to the provided script (allocates space, injects code, patches original).
generateAOBInjectionScript Generates and appends an Array-of-Bytes (AOB) injection script to the provided script (searches for pattern, injects code).
generateFullInjectionScript Generates and appends a complete full injection script with all patches and cleanup code.
generateAPIHookScript 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]

Function Description
debug_isDebugging Returns true if the debugger has been started and is active.
debug_getCurrentDebuggerInterface Returns the current debugger interface type: 1=Windows, 2=VEH, 3=Kernel, nil=no debugging.
debug_canBreak Returns true if the target process can stop on a breakpoint. (CE 6.4+)
debug_isBroken Returns true if the debugger is currently halted on a thread (at a breakpoint).
debug_getBreakpointList Returns a Lua table containing all currently active breakpoint addresses.

Breakpoint Management[edit]

Function Description
debugProcess Starts debugging the currently attached process.
debug_setBreakpoint Sets a breakpoint of a specific size (in bytes) at the given address.
debug_removeBreakpoint Removes a breakpoint at the specified address.
debug_continueFromBreakpoint Resumes execution when the debugger is halted on a breakpoint.
debug_addThreadToNoBreakList Adds a thread to the no-break list so breakpoints on it will be ignored.
debug_removeThreadFromNoBreakList Removes a thread from the no-break list.

Callbacks[edit]

Function Description
debugger_onBreakpoint User-defined callback invoked by CE when a breakpoint is hit (define your own implementation).
debugger_onModuleLoad User-defined callback invoked by the Windows debugger when a module is loaded.

Register and Context Management[edit]

Function Description
debug_getContext Force-updates the Lua variables representing CPU registers from the current thread context. (CE 6.5+)
debug_setContext Force-updates the CPU registers from the Lua variables representing them. (CE 6.5+)
debug_updateGUI Refreshes the UI to reflect the current debug context if the debugger is broken.
debug_getXMMPointer Returns the memory address of the specified XMM register for the currently broken thread.

Advanced Debugging[edit]

Function Description
debug_setLastBranchRecording Tells the kernel-mode debugger to record the last few branch/jump instructions before a breakpoint is hit.
debug_getMaxLastBranchRecord Returns the maximum number of branch records this CPU supports.
debug_getLastBranchRecord Returns the Last Branch Record value at the given index (when handling a breakpoint with branch recording enabled).
detachIfPossible 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]

Function Description
dbk_initialize Loads and initializes the DBK kernel driver into memory if possible.
dbk_useKernelmodeOpenProcess Redirects OpenProcess API calls to use kernel-mode DBK equivalents.
dbk_useKernelmodeProcessMemoryAccess Redirects ReadProcessMemory and WriteProcessMemory to use kernel-mode DBK versions.
dbk_useKernelmodeQueryMemoryRegions Redirects virtual memory query APIs to use kernel-mode DBK equivalents.

Process and Thread Information[edit]

Function Description
dbk_getPEProcess Returns the kernel pointer to the EPROCESS structure of the selected process ID.
dbk_getPEThread Returns the kernel pointer to the ETHREAD structure of a given thread ID.

CPU Register Access[edit]

Function Description
dbk_readMSR Reads a Model-Specific Register (MSR) using the DBK driver.
dbk_writeMSR Writes a Model-Specific Register (MSR) using the DBK driver.
dbk_getCR0 Returns the value of Control Register 0 (CR0).
dbk_getCR3 Returns the value of Control Register 3 (CR3) for the currently opened process.
dbk_getCR4 Returns the value of Control Register 4 (CR4).

Memory and Execution[edit]

Function Description
dbk_getPhysicalAddress Converts a virtual address to its physical address using the DBK driver.
dbk_executeKernelMemory Executes a routine from kernel mode (e.g. injected code written with Auto Assembler).
dbk_writesIgnoreWriteProtection 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]

Function Description
dbvm_initialize Initializes the DBVM hypervisor functions for use.

Memory Operations[edit]

Function Description
dbvm_addMemory Adds a memory region to DBVM.
dbvm_readPhysicalMemory Reads physical memory directly using DBVM (hypervisor-level access).
dbvm_writePhysicalMemory Writes physical memory directly using DBVM (hypervisor-level access).

MSR and Control Register Access[edit]

Function Description
dbvm_readMSR Reads a Model-Specific Register (MSR) using DBVM (bypasses driver).
dbvm_writeMSR Writes a Model-Specific Register (MSR) using DBVM (bypasses driver).
dbvm_getCR4 Returns the real (unhooked) value of Control Register 4 (CR4).

Memory Monitoring[edit]

Function Description
dbvm_watch_writes Starts monitoring write accesses to a memory region.
dbvm_watch_reads Starts monitoring read accesses to a memory region.
dbvm_watch_retrievelog Retrieves the log/results of memory region monitoring (reads or writes).
dbvm_watch_disable Stops memory region monitoring.

Memory Cloaking[edit]

Function Description
dbvm_cloak_activate Cloaks a memory page so modifications become invisible to the target process.
dbvm_cloak_deactivate Disables cloaking on a page and undoes hidden modifications.
dbvm_cloak_readOriginal Reads the original (hidden) memory contents of a cloaked region.
dbvm_cloak_writeOriginal Writes to the original (hidden) memory contents of a cloaked region.

Breakpoints and Debugging[edit]

Function Description
dbvm_changeregonbp Cloaks a page, sets a breakpoint at the given address, and modifies registers when the breakpoint is hit.
dbvm_removechangeregonbp Removes a "change registers on breakpoint" breakpoint.

CR3 (Process Context) Logging[edit]

Function Description
dbvm_log_cr3_start Starts logging all CR3 (process context/page directory) changes.
dbvm_log_cr3_stop Stops CR3 logging.

Performance and Anti-Detection[edit]

Function Description
dbvm_speedhack_setSpeed Sets system-wide speed hack via DBVM (affects all processes).
dbvm_setTSCAdjust Configures TSC (Time Stamp Counter) adjustment to bypass VM detection (RDTSC hooks).

Translation[edit]

Function Description
getTranslationFolder Returns the path to the current translation files. Returns an empty string if no translation is active.
loadPOFile Loads a ".PO" translation file into Cheat Engine's translation system.
translate Returns the translated text for a given source string. If no translation is found, returns the original string.
translateID Returns the translation for a specific string ID (lookup by numerical or symbolic ID).

Files[edit]

Function Description
getFileVersion Returns a 64-bit file version and a table splitting the version into major, minor, release, and build.
getFileList Returns an indexed table (array) of filenames in the specified directory.
getDirectoryList Returns an indexed table (array) of subdirectory names in the specified directory.

Structures[edit]

Function Description
registerStructureDissectOverride Registers a callback similar to onAutoGuess that the structure dissect window calls when the user requests Cheat Engine to guess a structure layout.
unregisterStructureDissectOverride Unregisters a previously registered structure dissect auto-guess override.
registerStructureNameLookup Registers a function that will be called when the structure dissect UI requests a name for a newly detected structure definition.
unregisterStructureNameLookup Unregisters a previously registered structure name lookup callback.

Miscellaneous[edit]

Function Description
injectDll Injects a DLL into the currently opened process.
shellExecute Executes a given command or opens a file/URL using the system shell.
executeCode Executes a stdcall function at a given address in the target process with one parameter and waits for it to return.
executeCodeEx Extended version of executeCode (supports more parameters/options).
executeCodeLocal Executes a stdcall function at a given address in Cheat Engine's own process (local execution).
executeCodeLocalEx Extended version of executeCodeLocal with additional options.
onAPIPointerChange Registers a callback invoked when an API pointer is changed (allows reacting to API remapping).
setAPIPointer Sets the pointer/address used for a specified API function.
md5memory Computes and returns the MD5 checksum (hex string) of the bytes at the provided memory address/size.
md5file Computes and returns the MD5 checksum (hex string) of a file's contents.
getSystemMetrics Retrieves the specified system metric or configuration setting. See: MSDN documentation.
getTickCount Returns the tick count in milliseconds since the system started.
getUserRegistryEnvironmentVariable Reads an environment variable stored in the current user's registry environment.
setUserRegistryEnvironmentVariable Writes an environment variable to the current user's registry environment.
broadcastEnvironmentUpdate Broadcasts a notification that environment variables were changed (call after setting registry variables).
getApplication Returns the application object (main application/titlebar context).
getInternet Returns an Internet client class object. The provided string specifies the client name/type.

Classes[edit]

A compact list of notable classes implemented by Cheat Engine.

Class Short description
Addresslist Container for memory records in a cheat table.
Bitmap Bitmap graphic object for drawing images.
Brush Brush used by a Canvas to fill areas.
Button Visual button component.
ButtonControl Base class common to button-like controls.
Canvas Drawing surface used in paint events for lines, text, and images.
Calendar Calendar/date-picker UI control.
CEForm Cheat Engine main/form window class.
CheatComponent Component used in Cheat Engine 5.x trainers.
CheckBox Checkbox UI control supporting checked/unchecked/indeterminate states.
Component Base class for owner-managed components.
Control Base class for visible UI controls.
Collection Abstract collection class (used by ListColumns and similar).
CollectionItem Item managed by a Collection.
ComboBox Edit field with an attached dropdown ListBox.
CriticalSection Synchronization primitive for thread-safe access.
CustomControl Base class for windowed controls that handle their own painting.
CustomType Custom data-type converter for interpreting raw memory.
D3DHOOK D3D hook helper for rendering overlays in DirectX 9/10/11 games.
D3DHook_FontMap Font texture map used by D3D hook rendering.
D3DHook_Texture Texture management for D3D hook sprites.
D3Dhook_TextContainer Text container used to draw text via D3D hook.
D3DHook_RenderObject Abstract render object controlling rendering behavior.
D3DHook_Sprite Rendered sprite/texture displayed via D3D hook.
Disassembler Disassembler helper class.
Disassemblerview Visual disassembler UI used in Memory View.
DisassemblerviewLine Single line entry in a disassembler view.
DissectCode Structure dissection helper.
Edit Single-line text edit control.
Event Event wrapper class for callbacks.
FileStream Stream class for file-based I/O.
FileDialog Standard file selection dialog wrapper.
FindDialog Search/find dialog class.
Font Font definition and metrics class.
Form Window/form class.
FoundList Companion class for MemScan results; reads result files.
GenericHotkey Register hotkeys with CE's hotkey handler.
Graphic Abstract base for image/graphic classes.
GraphicControl Lightweight control for simple graphics.
GroupBox Panel-like container with a header.
Hexadecimal Hex display helper used by Memory View.
Hexadecimalview Hex display UI component in the Memory View.
Icon Icon resource wrapper.
Image Image control for displaying pictures.
Internet Internet client helper class.
JpegImage JPEG image handler class.
Label Static text label control.
LuaPipe Abstract pipe communication class.
LuaPipeClient Client implementation for pipe communication.
LuaPipeServer Server implementation for pipe communication.
ListBox List box control with selectable strings.
ListColumn Column descriptor for a ListView.
ListColumns Container for ListColumn objects.
ListItem Entry in a ListView.
ListItems Container for ListItem objects.
Listview Multi-column list view control.
MainMenu Top-level menu bar for a form.
Memo Multi-line text editor control.
MemScan Memory scanner class for performing scans.
Menu Common ancestor for menu-related classes.
MenuItem Menu item descriptor.
MemoryRecord Cheat table entry describing an address/value/hotkey etc.
MemoryRecordHotkey Hotkey interface for a MemoryRecord.
MemoryStream In-memory stream class.
Memoryview Memory view (hex editor) window class.
MultiReadExclusiveWriteSynchronizer Synchronizer for safe concurrent read/write access.
Object Root base class for most CE classes.
PaintBox Control for custom painting surface.
PageControl Container for multiple pages/tabs.
Panel Container control for grouping child controls.
Pen Drawing pen used by Canvas for lines.
Picture Container for Graphic objects.
PopupMenu Context (right-click) menu class.
PortableNetworkGraphic PNG image class.
ProgressBar Visual progress indicator control.
RadioGroup Group of radio-button controls.
RasterImage Base class for raster image controls.
RIPRelativeScanner Helper for RIP-relative instruction scanning.
OpenDialog File open dialog class.
SaveDialog File save dialog class.
SelectDirectoryDialog Directory selection dialog class.
Semaphore Semaphore synchronization primitive.
Settings Access and modify Cheat Engine settings and store plugin data.
Splitter UI splitter control for resizing panels.
Stringlist Ordered list container for strings.
Strings Abstract base for text collections.
StringStream Stream wrapper around a string buffer.
Structure Structure definition class for memory layouts.
StructureElement Single element inside a Structure.
StructureFrm Structure editor/dissector form class.
structGroup Grouping helper for structure elements.
SymbolList Symbol lookup class (address ↔ name).
TabSheet Single page within a PageControl.
TableFile Represents a file stored inside a cheat table.
Thread Thread wrapper class.
Timer Non-visual timer component triggering onTimer events.
ToggleBox Toggleable button-like control.
TrackBar Slider control for numeric values.
TreeNode Node in a Treeview.
TreeNodes Container for TreeNode objects.
Treeview Tree view control.
WinControl Base class for windowed controls.
xmplayer XM player class for tracker music playback.

SQL Classes[edit]

Class Short description
CustomConnection Base for custom DB connection implementations.
Database Database container/manager for connections and datasets.
SQLConnection Generic SQL connection abstraction.
SQLite3Connection SQLite3 connection implementation.
ODBCConnection ODBC data source connection.
DBTransaction Transaction object for DB operations.
SQLTransaction SQL-specific transaction object.
Param Single query parameter object.
Params Parameter container for queries.
Fields Field metadata and values container.
Dataset Abstract dataset representing query results.
DBDataset Database-backed dataset implementation.
CustomBufDataset In-memory buffered dataset.
CustomSQLQuery Extended/custom SQL query object.
SQLQuery Standard SQL query executor and result-holder.

Class Helper Functions[edit]

Function Description
inheritsFromObject Returns true if the given object/class inherits from Object.
inheritsFromComponent Returns true if the object/class inherits from Component.
inheritsFromControl Returns true if the object/class inherits from Control.
inheritsFromWinControl Returns true if the object/class inherits from WinControl.
createClass Creates an instance of the specified registered class (default constructor).
createComponentClass 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.

Function Description
getPropertyList Returns a StringList of published property names for the specified class.
setProperty Sets the value of a published property on an object instance (not usable for method properties).
getProperty Gets the value of a published property on an object instance (not usable for method properties).
setMethodProperty Assigns a Lua function to a method/event property on an object.
getMethodProperty Retrieves a callable wrapper to invoke the original method/property on the object.
⚠️ This page still needs significant improvements.

Please help by expanding or correcting this article where possible.
For suggestions or discussion, see the talk page.