Difference between revisions of "Lua"

From Cheat Engine
Jump to navigation Jump to search
m (Scanning)
(Major overhaul of the post.)
Line 2: Line 2:
 
[[Category:Lua]]
 
[[Category:Lua]]
 
Cheat Engine comes with an extensive set of Lua functions you can use inside cheat tables, 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 ==
 
* [[Lua:TrainerOrigin|TrainerOrigin]]: A variable that contains the path of the trainer that launched cheat engine (Only set when launched as a trainer)
 
* [[Lua:process|process]]: A variable that contains the main modulename of the currently opened process
 
* [[Lua:MainForm|MainForm]]: The main Cheat Engine gui
 
* [[Lua:AddressList|AddressList]]: The address list of the main Cheat Engine gui
 
  
 
== Variables ==
 
== Variables ==
* [[Lua:Debug_Variables|Debug Variables]]
 
** EFLAGS
 
** '''32/64-bit''': EAX, EBX, ECX, EDX, EDI, ESI, EBP, ESP, EIP
 
** '''64-bit only''': RAX, RBX, RCX, RDX, RDI, RSI, RBP, RSP, RIP, R8, R9, R10, R11, R12, R13, R14, R15 : The value of the register
 
 
= Functions =
 
 
== Cheat table ==
 
These functions help manage the cheat table.
 
 
* [[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
 
* [[Lua:createTableFile|createTableFile]]: Add a new file to a cheat table
 
* [[Lua:loadTable|loadTable]]: Loads a ".ct" or ".cetrainer" file or stream
 
* [[Lua:saveTable|saveTable]]: Saves the current table
 
 
== Trainers ==
 
* [[Lua:registerEXETrainerFeature|registerEXETrainerFeature]]: Adds a new feature to the exe trainer generator window, and calls your function when the user builds an .exe trainer
 
* [[Lua:unregisterEXETrainerFeature|unregisterEXETrainerFeature]]: Unregisters the trainer feature
 
 
 
== Protection ==
 
* [[Lua:activateProtection|activateProtection]]: Prevents basic memory scanners from opening the cheat engine process
 
* [[Lua:enableDRM|enableDRM]]: Prevents normal memory scanners from reading the Cheat Engine process (kernelmode)
 
* [[Lua:encodeFunction|encodeFunction]]: Converts a given function into an encoded string that you can pass on to [[Lua:decodeFunction|decodeFunction]]
 
* [[Lua:decodeFunction|decodeFunction]]: Converts an encoded string back into a function
 
 
 
== Scanning ==
 
These functions control Cheat Engine's scanning.
 
 
* [[Lua:AOBScan|AOBScan]]: Scans the currently opened process and returns a [[Lua:Class:StringList|StringList]] object containing all the results
 
* [[Lua:AOBScanModuleUnique|AOBScanModuleUnique]]: Scans the entire process memory for a byte pattern and returns the address if exactly one unique match is found, otherwise returns nil
 
* [[Lua:AOBScanUnique|AOBScanUnique]]: Scans the entire process memory for a byte pattern and returns the address if exactly one unique match is found, otherwise returns nil
 
* [[Lua:getCurrentMemscan|getCurrentMemscan]]: Returns the currently active scan session as a [[Lua:Class:MemScan|MemScan]] object
 
 
== Process ==
 
* [[Lua:createProcess|createProcess]]: Creates a process with or without debugging
 
* [[Lua:openProcess|openProcess]]: Causes cheat engine to open the given processname or id
 
* [[Lua:onOpenProcess|onOpenProcess]]: Called by CE when it opens a process (userdefined)
 
* [[Lua:getForegroundProcess|getForegroundProcess]]: Returns the process ID of the process that is currently on top
 
* [[Lua:getOpenedProcessID|getOpenedProcessID]]: Returns the currently opened process
 
* [[Lua:getProcessIDFromProcessName|getProcessIDFromProcessName]]: Returns a processid
 
* [[Lua:openFileAsProcess|openFileAsProcess]]: Causes cheat engine to open the file with memory access as if it's a process
 
* [[Lua:saveOpenedFile|saveOpenedFile]]: Saves the changes of the opened file
 
* [[Lua:setPointerSize|setPointerSize]]: Sets the size cheat engine will deal with pointers in bytes. (Some 64-bit processes can only use 32-bit addresses)
 
* [[Lua:setAssemblerMode|setAssemblerMode]]: Sets the assembler's bit size mode (0=32-bit, 1=64-bit)
 
* [[Lua:getProcesslist|getProcesslist]]: Returns a processlist of the system
 
* [[Lua:getWindowlist|getWindowlist]]: Returns the top-window list of the system
 
* [[Lua:pause|pause]]: Pauses the current opened process
 
* [[Lua:unpause|unpause]]: Resumes the current opened process
 
* [[Lua:targetIs64Bit|targetIs64Bit]]: Returns true if the target process is 64-bit, false if 32-bit
 
* [[Lua:enumModules|enumModules]]: Returns a table containing information about each module in the current process, or the specified process ID
 
* [[Lua:closeRemoteHandle|closeRemoteHandle]]: Closes the handle of a process
 
  
 +
=== 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).
 +
|}
  
== Threads ==
+
=== CPU / Debug Variables (Registers) ===
* [[Lua:getCPUCount|getCPUCount]]: Returns the number of CPU's
+
{| class="wikitable" style="width:85%;"
* [[Lua:getThreadlist|getThreadlist]]: Fills a List object with the threadlist of the currently opened process
+
! Register / Variable
* [[Lua:inMainThread|inMainThread]]: Returns true if the current code is running inside the main thread (6.4+)
+
! Architecture
* [[Lua:synchronize|synchronize]]: Calls the given function from the main thread. Returns the return value of the given function
+
! Description
* [[Lua:queue|queue]]: Calls the given function from the main thread. Does not wait for the result
+
|-
* [[Lua:checkSynchronize|checkSynchronize]]: Call this from an infinite loop in the main thread when using threading and synchronize calls
+
| 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 ==
  
== Handles ==
+
=== Cheat Table ===
* [[Lua:getHandleList|getHandleList]]: Returns a table with all the handles in the system
+
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.
 +
|}
  
== Addresses ==
+
=== Protection ===
These functions help convert between memory addresses and [[symbol]]s/[[CEAddressString]]s.
+
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.
 +
|}
  
* [[Lua:getAddress|getAddress]]: Returns the address of a symbol. Can be a modulename or an export
+
=== Scanning ===
* [[Lua:getAddressSafe|getAddressSafe]]: Returns the address of a symbol, or nil if not found. Similar to getAddress when errorOnLookup is false, but returns nil instead
+
Functions that control and query memory scans.
* [[Lua:getNameFromAddress|getNameFromAddress]]: Returns the given address in string form, returning the symbol representation if possible
+
{| class="wikitable" style="width:85%;"
* [[Lua:registerSymbol|registerSymbol]]: Assign the specified symbolname to an address
+
! Function
* [[Lua:unregisterSymbol|unregisterSymbol]]: Remove the name from the address
+
! Description
* [[Lua:getSymbolInfo|getSymbolInfo]]: Returns a table as defined by the [[Lua:Class:SymbolList|SymbolList]] class object (module name, search key, address, size)
+
|-
* [[Lua:reinitializeSymbolhandler|reinitializeSymbolhandler]]: Reinitializes the symbolhandler. E.g when new modules have been loaded
+
| [[Lua:AOBScan|AOBScan]]
* [[Lua:inModule|inModule]]: Returns true if the given address is inside a module
+
| Scans the currently opened process for an array-of-bytes (AOB) pattern and returns a [[Lua:Class:StringList|StringList]] of all matches.
* [[Lua:inSystemModule|inSystemModule]]: Returns true if the given address is inside a system module
+
|-
* [[Lua:getModuleSize|getModuleSize]]: Returns the size of a given module (Use getAddress to get the base address)
+
| [[Lua:AOBScanModuleUnique|AOBScanModuleUnique]]
* [[Lua:errorOnLookupFailure|errorOnLookupFailure]]: Set whether address lookups will throw errors, or just return 0.
+
| 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:registerSymbolLookupCallback|registerSymbolLookupCallback]]: Registers a function to be called when a a symbol is parsed
+
|-
* [[Lua:unregisterSymbolLookupCallback|unregisterSymbolLookupCallback]]: Removes the callback
+
| [[Lua:AOBScanUnique|AOBScanUnique]]
* [[Lua:registerAddressLookupCallback|registerAddressLookupCallback]]: Registers a function to be called when the name of an address is requested
+
| Scans the entire process for a pattern and returns the address if exactly one unique match exists; returns <code>nil</code> otherwise.
* [[Lua:unregisterAddressLookupCallback|unregisterAddressLookupCallback]]: Removes the callback
+
|-
* [[Lua:reinitializeDotNetSymbolhandler|reinitializeDotNetSymbolhandler]]: Reinitializes only the DotNet part of the symbol list
+
| [[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.
 +
|}
  
== Memory ==
+
=== Threads ===
* [[Lua:allocateMemory|allocateMemory]]: Allocates some memory into the target process
+
{| class="wikitable" style="width:85%;"
* [[Lua:deAlloc|deAlloc]]: Frees allocated memory
+
! Function
* [[Lua:allocateSharedMemory|allocateSharedMemory]]: Creates a shared memory object of the given size if it doesn't exist yet
+
! Description
* [[Lua:createSection|createSection]]: Creates a 'section' in memory
+
|-
* [[Lua:mapViewOfSection|mapViewOfSection]]: Maps the section to memory
+
| [[Lua:getCPUCount|getCPUCount]]
* [[Lua:unMapViewOfSection|unMapViewOfSection]]: Unmaps a section from memory
+
| Returns the number of CPU cores available on the system.
* [[Lua:copyMemory|copyMemory]]: Copies memory from the given address to the destination address
+
|-
* [[Lua:allocateKernelMemory|allocateKernelMemory]]: Allocates a block of nonpaged memory and returns the address
+
| [[Lua:getThreadlist|getThreadlist]]
* [[Lua:freeKernelMemory|freeKernelMemory]]: Frees the given memory region
+
| Fills a List object with the thread list of the currently opened process (returns thread IDs and basic info).
* [[Lua:mapMemory|mapMemory]]: Maps a specific address to the usermode context from the given PID to the given PID
+
|-
* [[Lua:unmapMemory|unmapMemory]]:
+
| [[Lua:inMainThread|inMainThread]]
* [[Lua:createMemoryStream|createMemoryStream]]:
+
| 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 read/write memory from the opened process.
+
=== 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.
 +
|}
  
=== Reading ===
+
=== Addresses ===
* [[Lua:readBytes|readBytes]]: Returns the bytes at the given address. If ReturnAsTable is true it will return a table instead of multiple bytes
+
These functions help convert between memory addresses and symbol/CE address string representations.
* [[Lua:readSmallInteger|readSmallInteger]]: Reads a 16-bit integer from the specified address.
+
{| class="wikitable" style="width:85%;"
* [[Lua:readInteger|readInteger]]: Reads a 32-bit integer from the specified address.
+
! Function
* [[Lua:readQword|readQword]]: Reads a 64-bit integer from the specified address.
+
! Description
* [[Lua:readPointer|readPointer]]: In a 64-bit target this equals readQword, in a 32-bit target readInteger().
+
|-
* [[Lua:readFloat|readFloat]]: Reads a single precision floating point value from the specified address
+
| [[Lua:getAddress|getAddress]]
* [[Lua:readDouble|readDouble]]: Reads a double precision floating point value from the specified address
+
| Returns the numeric address of a symbol (module+export, label, or CE symbol). Raises an error if the symbol cannot be resolved.
* [[Lua:readString|readString]]: Reads a string from memory until it hits a 0-terminator. maxlength is just so you won't freeze for too long
+
|-
* [[Lua:readRegionFromFile|readRegionFromFile]]: Writes the given file to a specific address
+
| [[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).
 +
|}
  
* [[Lua:readBytesLocal|readBytesLocal]]: See readBytes but then it's for Cheat engine's memory
+
=== Memory ===
* [[Lua:readSmallIntegerLocal|readSmallIntegerLocal]]: Reads a 16-bit integer from the specified address in CE's memory
+
{| class="wikitable" style="width:85%;"
* [[Lua:readIntegerLocal|readIntegerLocal]]: Reads a 32-bit integer from the specified address in CE's memory
+
! Function
* [[Lua:readQwordLocal|readQwordLocal]]: Reads a 64-bit integer from the specified address in CE's memory
+
! Description
* [[Lua:readPointerLocal|readPointerLocal]]: [[Lua:ReadQwordLocal|ReadQwordLocal]]/[[Lua:ReadIntegerLocal|ReadIntegerLocal]] depending on the cheat engine build
+
|-
* [[Lua:readFloatLocal|readFloatLocal]]: Reads a single precision floating point value from the specified address in CE's memory
+
| [[Lua:allocateMemory|allocateMemory]]
* [[Lua:readDoubleLocal|readDoubleLocal]]: Reads a double precision floating point value from the specified address in CE's memory
+
| Allocates executable/non-executable memory in the target process and returns the allocated address.
* [[Lua:readStringLocal|readStringLocal]]: Reads a string from CE's memory until it hits a 0-terminator
+
|-
 +
| [[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.
 +
|}
  
 +
==== 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.
 +
|}
  
=== Writing ===
+
==== Reading from Cheat Engine Memory ====
* [[Lua:writeBytes|writeBytes]]: Write the given bytes to the given address from a table
+
{| class="wikitable" style="width:85%;"
* [[Lua:writeSmallInteger|writeSmallInteger]]: Writes a 16-bit integer to the specified address. Returns true on success.
+
! Function
* [[Lua:writeInteger|writeInteger]]: Writes a 32-bit integer to the specified address. Returns true on success.
+
! Description
* [[Lua:writeQword|writeQword]]: Write a 64-bit integer to the specified address. Returns true on success.
+
|-
* [[Lua:writeFloat|writeFloat]]: Writes a single precision floating point to the specified address. Returns true on success.
+
| [[Lua:readBytesLocal|readBytesLocal]]
* [[Lua:writeDouble|writeDouble]]: Writes a double precision floating point to the specified address. Returns true on success.
+
| Same as <code>readBytes</code>, but reads from Cheat Engine's own memory.
* [[Lua:writeString|writeString]]: Write a string to the specified address. Returns true on success.
+
|-
* [[Lua:writeRegionToFile|writeRegionToFile]]: Writes the given region to a file. Returns the number of bytes written.
+
| [[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.
 +
|}
  
* [[Lua:writeSmallIntegerLocal|writeSmallIntegerLocal]]: Writes a 16-bit integer to the specified address in CE's memory. Returns true on success
+
==== Writing to Target Process ====
* [[Lua:writeIntegerLocal|writeIntegerLocal]]: Writes a 32-bit integer to the specified address in CE's memory. Returns true on success
+
{| class="wikitable" style="width:85%;"
* [[Lua:writeQwordLocal|writeQwordLocal]]: Writes a 64-bit integer to the specified address in CE's memory. Returns true on success
+
! Function
* [[Lua:writeFloatLocal|writeFloatLocal]]: Writes a single precision floating point to the specified address in CE's memory. Returns true on success
+
! Description
* [[Lua:writeDoubleLocal|writeDoubleLocal]]: Writes a double precision floating point to the specified address in CE's memory. Returns true on success
+
|-
* [[Lua:writeStringLocal|writeStringLocal]]: Write a string to the specified address. Returns true on success.
+
| [[Lua:writeBytes|writeBytes]]
* [[Lua:writeBytesLocal|writeBytesLocal]]: See writeBytes but then it's for Cheat Engine's memory
+
| 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.
 +
|}
  
** [[Lua:readSmallInteger|readSmallInteger]], [[Lua:readInteger|readInteger]], [[Lua:readSmallIntegerLocal|readSmallIntegerLocal]], [[Lua:readIntegerLocal|readIntegerLocal]] can also have second boolean parameter. If true, value will be signed.
+
==== 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.
 +
|}
  
== Conversions ==
+
=== Conversions ===
* [[Lua:ansiToUtf8|ansiToUtf8]]: Converts a string in ANSI encoding to UTF8
 
* [[Lua:utf8ToAnsi|utf8ToAnsi]]: Converts a string in UTF8 encoding to ANSI
 
* [[Lua:stringToMD5String|stringToMD5String]]: Returns an MD5 hash string from the provided string
 
* [[Lua:integerToUserData|integerToUserData]]: Converts a given integer to a userdata variable
 
* [[Lua:userDataToInteger|userDataToInteger]]: Converts a given userdata variable to an integer
 
  
=== To Byte Table ===
+
==== Encoding/Decoding ====
* [[Lua:wordToByteTable|wordToByteTable]]: Converts a word to a bytetable
+
{| class="wikitable" style="width:85%;"
* [[Lua:dwordToByteTable|dwordToByteTable]]: Converts a dword to a bytetable
+
! Function
* [[Lua:qwordToByteTable|qwordToByteTable]]: Converts a qword to a bytetable
+
! Description
* [[Lua:floatToByteTable|floatToByteTable]]: Converts a float to a bytetable
+
|-
* [[Lua:doubleToByteTable|doubleToByteTable]]: Converts a double to a bytetable
+
| [[Lua:ansiToUtf8|ansiToUtf8]]
* [[Lua:stringToByteTable|stringToByteTable]]: Converts a string to a bytetable
+
| Converts a string from ANSI encoding to UTF-8 encoding.
* [[Lua:wideStringToByteTable|wideStringToByteTable]]: Converts a string to a widestring and converts that to a bytetable
+
|-
 +
| [[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.
 +
|}
  
=== From Byte Table ===
+
==== To Byte Table ====
* [[Lua:byteTableToWord|byteTableToWord]]: Converts a bytetable to a word
+
Convert data types into byte tables (tables of individual byte values).
* [[Lua:byteTableToDword|byteTableToDword]]: Converts a bytetable to a dword
+
{| class="wikitable" style="width:85%;"
* [[Lua:byteTableToQword|byteTableToQword]]: Converts a bytetable to a qword
+
! Function
* [[Lua:byteTableToFloat|byteTableToFloat]]: Converts a bytetable to a float
+
! Description
* [[Lua:byteTableToDouble|byteTableToDouble]]: Converts a bytetable to a double
+
|-
* [[Lua:byteTableToString|byteTableToString]]: Converts a bytetable to a string
+
| [[Lua:wordToByteTable|wordToByteTable]]
* [[Lua:byteTableToWideString|byteTableToWideString]]: Converts a bytetable to a widestring and converts that to a string
+
| 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.
 +
|}
  
 +
==== 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).
 +
|}
  
=== Binary ===
+
==== Binary Operations ====
* [[Lua:bOr|bOr]]: Binary Or
+
Bitwise operations on integers.
* [[Lua:bXor|bXor]]: Binary Xor
+
{| class="wikitable" style="width:85%;"
* [[Lua:bAnd|bAnd]]: Binary And
+
! Function
* [[Lua:bShl|bShl]]: Binary shift left
+
! Description
* [[Lua:bShr|bShr]]: Binary shift right
+
|-
* [[Lua:bNot|bNot]]: Binary not
+
| [[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.
 +
|}
  
== Input devices ==
+
=== Input Devices ===
These functions get/set keyboard/mouse input.
 
  
* [[Lua:getMousePos|getMousePos]]: Returns the ''X'' and ''Y'' coordinates of the mouse
+
==== Keyboard & Mouse ====
* [[Lua:setMousePos|setMousePos]]: Sets the mouse position
+
{| class="wikitable" style="width:85%;"
* [[Lua:isKeyPressed|isKeyPressed]]: Returns true if the specified key is currently pressed
+
! Function
* [[Lua:keyDown|keyDown]]: Causes the key to go into down state
+
! Description
* [[Lua:keyUp|keyUp]]: Causes the key to go up
+
|-
* [[Lua:doKeyPress|doKeyPress]]: Simulates a key press
+
| [[Lua:getMousePos|getMousePos]]
* [[Lua:mouse_event|mouse_event]]: The Windows' API ''"mouse_event"''. [https://msdn.microsoft.com/en-us/library/windows/desktop/ms646260(v=vs.85).aspx msdn.microsoft.com/en-us/library/windows/desktop/ms646260(v=vs.85).aspx]
+
| Returns the current mouse cursor position as ''X'' and ''Y'' coordinates.
* [[Lua:setGlobalKeyPollInterval|setGlobalKeyPollInterval]]: Sets the global keypoll interval
+
|-
* [[Lua:setGlobalDelayBetweenHotkeyActivation|setGlobalDelayBetweenHotkeyActivation]]: Sets the minimum delay between the activation of the same hotey in milliseconds
+
| [[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.
 +
|}
  
=== Game Controller ===
+
==== Game Controller ====
* [[Lua:getXBox360ControllerState|getXBox360ControllerState]]: Fetches the state of the connected XBox controller
+
XBox/game controller input.
* [[Lua:setXBox360ControllerVibration|setXBox360ControllerVibration]]: Sets the speed of the left and right vibrating motor inside the controller
+
{| 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).
 +
|}
  
=== Clipboard ===
+
==== Clipboard ====
* [[Lua:writeToClipboard|writeToClipboard]]: Writes the given text to the clipboard
+
{| class="wikitable" style="width:85%;"
* [[Lua:readFromClipboard|readFromClipboard]]: Reads the text from the clipboard
+
! Function
 +
! Description
 +
|-
 +
| [[Lua:writeToClipboard|writeToClipboard]]
 +
| Writes the given text to the system clipboard.
 +
|}
  
 +
=== Screen ===
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:getScreenHeight|getScreenHeight]]
 +
| 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.
 +
|}
  
== Screen ==
+
=== Sounds ===
* [[Lua:getScreenHeight|getScreenHeight]]: Returns the screen height
 
* [[Lua:getScreenWidth|getScreenWidth]]: Returns the screen  width
 
* [[Lua:getScreenDPI|getScreenDPI]]: Returns the screen DPI
 
* [[Lua:getWorkAreaHeight|getWorkAreaHeight]]: Returns the work area height
 
* [[Lua:getWorkAreaWidth|getWorkAreaWidth]]: Returns the work area width
 
* [[Lua:getScreenCanvas|getScreenCanvas]]: Returns a Canvas object you can use to write to the screen (Note: Not as useful as you may think)
 
* [[Lua:getPixel|getPixel]]: Returns the RGB value of the pixel at the specific screen coordinate
 
  
== Sounds ==
+
==== General Audio ====
* [[Lua:playSound|playSound]]: Plays a sound file
+
{| class="wikitable" style="width:85%;"
* [[Lua:beep|beep]]: Plays the fabulous beep/ping sound!
+
! Function
* [[Lua:speak|speak]]: Speaks a given text using the given flags [https://msdn.microsoft.com/en-us/library/speechplatform_speakflags.aspx msdn.microsoft.com/en-us/library/speechplatform_speakflags.aspx]
+
! Description
* [[Lua:speakEnglish|speakEnglish]]: Will try the English voice by wrapping the given text into an XML statement specifying the English voice
+
|-
 +
| [[Lua:playSound|playSound]]
 +
| Plays an audio file (supports various formats like .wav, .mp3, etc.).
 +
|-
 +
| [[Lua:beep|beep]]
 +
| Plays a system beep/ping sound.
 +
|}
  
=== xmplayer ===
+
=== Text-to-Speech ===
* [[Lua:xmplayer_playXM|xmplayer_playXM]]: Plays the given filename using the xmplayer
+
{| class="wikitable" style="width:85%;"
* [[Lua:xmplayer_pause|xmplayer_pause]]: Pauses the current xm audio file
+
! Function
* [[Lua:xmplayer_resume|xmplayer_resume]]: Resumes the current xm audio file
+
! Description
* [[Lua:xmplayer_stop|xmplayer_stop]]: Stops the current xm audio file
+
|-
* [[Lua:xmplayer_isPlaying|xmplayer_isPlaying]]: Returns true if there is currently an xm audio file being played
+
| [[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.
 +
|}
  
== Text to Speech ==
+
==== XM Player ====
* [[Lua:speak|speak]]: Speaks a given text.
+
Plays tracked music (XM format) using the built-in XM player.
* [[Lua:speakEnglish|speakEnglish]]: Speaks a given text with English voice.
+
{| 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.
 +
|}
  
 +
=== Fonts ===
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[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.
 +
|}
  
== Fonts ==
+
=== 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>.
 +
|}
  
* [[Lua:loadFontFromStream|loadFontFromStream]]: Loads a font from a memory stream and returns an id (handle) to the font for use with [[unloadLoadedFont]]
+
=== Cheat Engine ===
* [[Lua:unloadLoadedFont|unloadLoadedFont]]: Unloads a font from a memory stream
+
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.
 +
|}
  
== Forms and Windows ==
+
==== 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.
 +
|}
  
* [[Lua:findWindow|findWindow]]: Finds a window with the given classname and/or windowname
+
==== Comments and Headers ====
* [[Lua:getWindow|getWindow]]: Gets a specific window based on the given window (Check MSDN getWindow for the command description)
+
{| class="wikitable" style="width:85%;"
* [[Lua:getWindowCaption|getWindowCaption]]: Returns the caption of the window
+
! Function
* [[Lua:getWindowClassName|getWindowClassName]]: Returns the classname of the window
+
! Description
* [[Lua:getWindowProcessID|getWindowProcessID]]: Returns the processid of the process this window belongs to
+
|-
* [[Lua:getForegroundWindow|getForegroundWindow]]: Returns the windowhandle of the topmost window
+
| [[Lua:getComment|getComment]]
* [[Lua:sendMessage|sendMessage]]: Sends a message to a window
+
| Gets the user-defined comment attached to the specified address.
* [[Lua:hookWndProc|hookWndProc]]: Hooks a window's wndproc procedure
+
|-
* [[Lua:unhookWndProc|unhookWndProc]]: Called when done with the hook from [[Lua:hookWndProc|hookWndProc]]
+
| [[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).
 +
|}
  
== Cheat Engine ==
+
==== Forms and UI ====
These functions help manage Cheat Engine itself.
+
{| 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.
 +
|}
  
* [[Lua:getCEVersion|getCEVersion]]: Returns a floating point value specifying the version of cheat engine
+
==== Messages ====
* [[Lua:getCheatEngineFileVersion|getCheatEngineFileVersion]]: Returns the full version data of the cheat engine version. A raw integer, and a table containing major, minor, release and build
+
{| class="wikitable" style="width:85%;"
* [[Lua:getFreezeTimer|getFreezeTimer]]: Returns the Timer object responsible for freezing values
+
! Function
* [[Lua:getUpdateTimer|getUpdateTimer]]: Returns the Timer object responsible for updating the value list
+
! Description
* [[Lua:getCommonModuleList|getCommonModuleList]]: Returns the commonModuleList [[Lua:Class:StringList|StringList]] object
+
|-
* [[Lua:getCheatEngineProcessID|getCheatEngineProcessID]]: Returns the processid of cheat engine
+
| [[Lua:showMessage|showMessage]]
* [[Lua:cheatEngineIs64Bit|cheatEngineIs64Bit]]: Returns true if Cheat Engine is 64-bit, false if 32-bit
+
| Shows a simple message box with the given text to the user.
* [[Lua:closeCE|closeCE]]: Closes Cheat Engine
+
|-
* [[Lua:getAutoAttachList|getAutoAttachList]]: Returns the AutoAttach [[Lua:Class:StringList|StringList]] object
+
| [[Lua:messageDialog|messageDialog]]
* [[Lua:connectToCEServer|connectToCEServer]]: Connects to the given host and port. On success, most commands subsequent will be handled by the server
+
| Pops up a message dialog box (similar to <code>showMessage</code>, with more control over buttons/options).
* [[Lua:supportCheatEngine|supportCheatEngine]]: Will show an advertising window which will help keep the development of Cheat Engine going.
+
|-
* [[Lua:fuckCheatEngine|fuckCheatEngine]]: Removes the ad window if it was showing
+
| [[Lua:outputDebugString|outputDebugString]]
* [[Lua:getCheatEngineDir|getCheatEngineDir]]: Returns the folder Cheat Engine (or the trainer) is located at.
+
| Outputs a message using the Windows <code>OutputDebugString</code> API (visible in debuggers).
* [[Lua:getComment|getComment]]: Gets the userdefined comment at the specified address
+
|-
* [[Lua:setComment|setComment]]: Sets a userdefined comment at the specifried address
+
| [[Lua:processMessages|processMessages]]
* [[Lua:getHeader|getHeader]]: Gets the userdefined header at the specified address
+
| Processes pending window messages in the event queue, allowing button clicks and UI updates to be handled.
* [[Lua:setHeader|setHeader]]: Sets the userdefined header at the specified address
+
|}
* [[Lua:registerBinUtil|registerBinUtil]]: Registers a binutils toolset with Cheat Engine
 
* [[Lua:reloadSettingsFromRegistry|reloadSettingsFromRegistry]]: This will cause cheat engine to reload the settings from the registry and apply them
 
* [[Lua:loadPlugin|loadPlugin]]: Loads the given plugin
 
* [[Lua:getSettings|getSettings]]: Returns a settings object
 
  
=== Forms ===
+
==== Input ====
* [[Lua:getFormCount|getFormCount]]: Returns the total number of forms assigned to the main CE application
+
{| class="wikitable" style="width:85%;"
* [[Lua:getForm|getForm]]: Returns the form at the specific index
+
! Function
* [[Lua:getMemoryViewForm|getMemoryViewForm]]: Returns the first Memoryview form class object
+
! Description
* [[Lua:getMainForm|getMainForm]]: Returns the first Mainform class object
+
|-
* [[Lua:getSettingsForm|getSettingsForm]]: Returns the main settings form
+
| [[Lua:inputQuery|inputQuery]]
* [[Lua:getLuaEngine|getLuaEngine]]: Returns the lua engine form object (Creates it if needed)
+
| Shows a dialog prompting the user to input a string. Returns the entered string, or <code>nil</code> if cancelled (CE 6.4+).
* [[Lua:unhideMainCEwindow|unhideMainCEwindow]]: Shows the main Cheat Engine window
+
|}
* [[Lua:hideAllCEWindows|hideAllCEWindows]]: Makes all normal Cheat Engine windows invisible (e.g trainer table)
 
* [[Lua:registerFormAddNotification|registerFormAddNotification]]: Registers a function to be called when a form is attached to Cheat Engine's form list
 
* [[Lua:unregisterFormAddNotification|unregisterFormAddNotification]]: unregister the FormAddNotification call back
 
  
=== Messages ===
+
==== Shortcuts ====
* [[Lua:showMessage|showMessage]]: Shows a message box with the given text
+
{| class="wikitable" style="width:85%;"
* [[Lua:messageDialog|messageDialog]]: Pops up a message box
+
! Function
* [[Lua:outputDebugString|outputDebugString]]: Outputs a message using the windows OutputDebugString message
+
! Description
* [[Lua:processMessages|processMessages]]: Lets the main eventhandler process the new messages (allows for new button clicks)
+
|-
 +
| [[Lua:shortCutToText|shortCutToText]]
 +
| Converts a shortcut integer value to its textual representation (e.g. <code>"Ctrl+Alt+A"</code>). (CE 6.4+)
 +
|-
 +
| [[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.
 +
|}
  
=== Input ===
+
==== Speed Hack ====
* [[Lua:inputQuery|inputQuery]]: Shows a dialog where the user can input a string. This function returns the given string, or nil on cancel  (CE6.4+)
+
{| 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.
 +
|}
  
=== Shortcuts ===
+
=== Lua ===
* [[Lua:shortCutToText|shortCutToText]]: Returns the textual representation of the given shortcut value (integer) (6.4+)
+
Functions for managing the Lua engine and state.
* [[Lua:textToShortCut|textToShortCut]]: Returns an shortcut integer that the given string represents. (6.4+)
 
* [[Lua:convertKeyComboToString|convertKeyComboToString]]: Returns a string representation of the given keys like the hot-key handler does
 
  
=== Speed Hack ===
+
{| class="wikitable" style="width:85%;"
* [[Lua:speedhack_setSpeed|speedhack_setSpeed]]: Enables the speed hack if it was not active yet and sets the given speed
+
! Function
* [[Lua:speedhack_getSpeed|speedhack_getSpeed]]: Returns the last set speed
+
! 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.
  
== Lua ==
+
{| class="wikitable" style="width:85%;"
These functions help manage Lua itself.
+
! 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.
 +
|}
  
* [[Lua:resetLuaState|resetLuaState]]: This will create a new Lua state that will be used.
+
=== Object-oriented ===
* [[Lua:sleep|sleep]]: Pauses for the number of specified milliseconds
+
Functions for determining class inheritance and type relationships.
* [[Lua:createRef|createRef]]: Integer - Returns an integer reference that you can use with getRef
 
* [[Lua:getRef|getRef]]: Returns whatever the reference points out
 
* [[Lua:destroyRef|destroyRef]]: Removes the reference
 
  
 +
{| class="wikitable" style="width:85%;"
 +
! 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).
 +
|}
  
== Types ==
+
=== Assembly ===
These functions help structure a process's memory into datatypes.
+
Functions for working with x86/x64 machine code and assembly instructions.
  
* [[Lua:onAutoGuess|onAutoGuess]]: Registers an function to be called whenever autoguess is used to predict a variable type.
+
{| class="wikitable" style="width:85%;"
* [[Lua:registerCustomTypeLua|registerCustomTypeLua]]: Registers a [[custom type]] based on Lua functions.
+
! Function
* [[Lua:registerCustomTypeAutoAssembler|registerCustomTypeAutoAssembler]]: Registers a custom type based on an auto assembler script.
+
! 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.
 +
|}
  
 +
=== Auto Assembler ===
  
== Object-oriented ==
+
==== Commands & Hooks ====
These functions determine how a Lua object fits in the class hierarchy.
+
{| class="wikitable" style="width:85%;"
 +
! 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.
 +
|}
  
* [[Lua:inheritsFromObject|inheritsFromObject]]: Returns true if given any class
+
==== Scripts & Templates ====
* [[Lua:inheritsFromComponent|inheritsFromComponent]]: Returns true if the given object inherits from the Component class
+
{| class="wikitable" style="width:85%;"
* [[Lua:inheritsFromControl|inheritsFromControl]]: Returns true if the given object inherits from the Control class
+
! Function
* [[Lua:inheritsFromWinControl|inheritsFromWinControl]]: Returns true if the given object inherits from the WinControl class
+
! 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.
 +
|}
  
 +
=== Debugger ===
 +
Functions for managing the debugger. See [[Lua Debugging]] for detailed information.
  
== Assembly ==
+
==== 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.
 +
|}
  
These functions help work with the x86 machine code as assembly.
+
==== Breakpoint Management ====
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! 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.
 +
|}
  
* [[Lua:autoAssemble|autoAssemble]]: Runs the auto assembler with the given text
+
==== Callbacks ====
* [[Lua:autoAssembleCheck|autoAssembleCheck]]: Checks the script for syntax errors. Returns true on succes, false with an error message on failure
+
{| class="wikitable" style="width:85%;"
* [[Lua:disassemble|disassemble]]: Disassembles the given address and returns a string in the format of "address - bytes - opcode  extra"
+
! Function
* [[Lua:splitDisassembledString|splitDisassembledString]]: Returns 4 strings. The address, bytes, opcode and extra field
+
! Description
* [[Lua:getInstructionSize|getInstructionSize]]: Returns the size of an instruction
+
|-
* [[Lua:getPreviousOpcode|getPreviousOpcode]]: Returns the address of the previous opcode (guess)
+
| [[Lua:debugger_onBreakpoint|debugger_onBreakpoint]]
* [[Lua:registerAssembler|registerAssembler]]: Registers a function to be called when the single line assembler is invoked to convert an instruction to a list of bytes
+
| User-defined callback invoked by CE when a breakpoint is hit (define your own implementation).
* [[Lua:unregisterAssembler|unregisterAssembler]]: Unregisters the registered assembler
+
|-
 +
| [[Lua:debugger_onModuleLoad|debugger_onModuleLoad]]
 +
| User-defined callback invoked by the Windows debugger when a module is loaded.
 +
|}
  
 +
==== 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.
 +
|}
  
== Auto Assembler ==
+
==== Advanced Debugging ====
* [[Lua:registerAutoAssemblerCommand|registerAutoAssemblerCommand]]: Registers an auto assembler command to call the specified function
+
{| class="wikitable" style="width:85%;"
* [[Lua:unregisterAutoAssemblerCommand|unregisterAutoAssemblerCommand]]: Unregisters an auto assembler command
+
! Function
* [[Lua:registerAutoAssemblerPrologue|registerAutoAssemblerPrologue]]: Registers a function to be called when the auto assembler is about to parse an auto assembler script
+
! Description
* [[Lua:unregisterAutoAssemblerPrologue|unregisterAutoAssemblerPrologue]]: Unregisters an auto assembler prologue
+
|-
* [[Lua:fullAccess|fullAccess]]: Changes the protection of a block of memory to writable and executable
+
| [[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.
 +
|}
  
 +
=== DBK (Driver-Based Kernel) ===
 +
Functions for kernel-mode operations via the DBK driver.
  
=== Scripts ===
+
==== Initialization and Setup ====
* [[Lua:registerAutoAssemblerTemplate|registerAutoAssemblerTemplate]]: Registers a template for the auto assembler
+
{| class="wikitable" style="width:85%;"
* [[Lua:unregisterAutoAssemblerTemplate|unregisterAutoAssemblerTemplate]]: Unregisters a template for the auto assembler
+
! Function
* [[Lua:generateCodeInjectionScript|generateCodeInjectionScript]]: Adds a default code injection script to the given script
+
! Description
* [[Lua:generateAOBInjectionScript|generateAOBInjectionScript]]: Adds an AOB injection script to the given script
+
|-
* [[Lua:generateFullInjectionScript|generateFullInjectionScript]]: Adds a Full Injection script to the given script
+
| [[Lua:dbk_initialize|dbk_initialize]]
* [[Lua:generateAPIHookScript|generateAPIHookScript]]: Generates an auto assembler script which will hook the given address when executed
+
| 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.
 +
|}
  
 +
==== 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.
 +
|}
  
== Debugger ==
+
==== CPU Register Access ====
These functions manage the debugger. See ''[[Lua Debugging]]''.
+
{| 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).
 +
|}
  
* [[Lua:debug_isDebugging|debug_isDebugging]]: Returns true if the debugger has been started
+
==== Memory and Execution ====
* [[Lua:debug_getCurrentDebuggerInterface|debug_getCurrentDebuggerInterface]]: Returns the current debuggerinterface used (1=windows, 2=VEH 3=Kernel, nil=no debugging active)
+
{| class="wikitable" style="width:85%;"
* [[Lua:debug_canBreak|debug_canBreak]]: Returns true if there is a possibility the target can stop on a breakpoint. 6.4+
+
! Function
* [[Lua:debug_isBroken|debug_isBroken]]: Returns true if the debugger is currently halted on a thread
+
! Description
* [[Lua:debug_getBreakpointList|debug_getBreakpointList]]: Returns a lua table containing all the breakpoint addresses
+
|-
* [[Lua:debugProcess|debugProcess]]: Debugs the currently attached process
+
| [[Lua:dbk_getPhysicalAddress|dbk_getPhysicalAddress]]
* [[Lua:debug_setBreakpoint|debug_setBreakpoint]]: Sets a breakpoint of a specific size at the given address
+
| Converts a virtual address to its physical address using the DBK driver.
* [[Lua:debugger_onBreakpoint|debugger_onBreakpoint]]: Called by CE when a breakpoint hits (userdefined)
+
|-
* [[Lua:debug_removeBreakpoint|debug_removeBreakpoint]]: Removes a breakpoint
+
| [[Lua:dbk_executeKernelMemory|dbk_executeKernelMemory]]
* [[Lua:debug_continueFromBreakpoint|debug_continueFromBreakpoint]]: Continues the debugger when it's halted on a breakpoint
+
| Executes a routine from kernel mode (e.g. injected code written with Auto Assembler).
* [[Lua:debug_setLastBranchRecording|debug_setLastBranchRecording]]: Tells the kernelmode debugger to record the last few branches before the breakpoint got hit
+
|-
* [[Lua:debug_getMaxLastBranchRecord|debug_getMaxLastBranchRecord]]: Returns the maximum number of branch records this cpu supports
+
| [[Lua:dbk_writesIgnoreWriteProtection|dbk_writesIgnoreWriteProtection]]
* [[Lua:debug_getLastBranchRecord|debug_getLastBranchRecord]]: Returns the value of the Last Branch Record at the given index (when handling a breakpoint)
+
| When set to <code>true</code>, write operations bypass copy-on-write behavior.
* [[Lua:debugger_onModuleLoad|debugger_onModuleLoad]]: Called by CE when the windows debugger interface loads a module (userdefined)
+
|}
* [[Lua:debug_getContext|debug_getContext]] (since 6.5): Force-update the Lua variables representing the registers?
 
* [[Lua:debug_setContext|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:debug_updateGUI|debug_updateGUI]]: Will refresh the userinterface to reflect the new context if the debugger was broken
 
* [[Lua:detachIfPossible|detachIfPossible]]: Detaches the debugger from the target process (if it was attached)
 
* [[Lua:debug_addThreadToNoBreakList|debug_addThreadToNoBreakList]]: This will cause breakpoints on the provided thread to be ignored
 
* [[Lua:debug_removeThreadFromNoBreakList|debug_removeThreadFromNoBreakList]]: removed the threadid from the list
 
* [[Lua:debug_getXMMPointer|debug_getXMMPointer]]: Returns the address of the specified xmm register of the thread that is currently broken
 
* [[Lua:debugger_onModuleLoad|debugger_onModuleLoad]]: This routine is called when a module is loaded. Only works for the windows debugger
 
  
 +
=== DBVM ===
 +
Functions for hypervisor-based operations and advanced memory monitoring via DBVM.
  
== DBK ==
+
==== Initialization ====
* [[Lua:dbk_initialize|dbk_initialize]]: Loads the DBK driver into memory if possible
+
{| class="wikitable" style="width:85%;"
* [[Lua:dbk_useKernelmodeOpenProcess|dbk_useKernelmodeOpenProcess]]: Switches the internal pointer of the OpenProcess api to dbk_OpenProcess
+
! Function
* [[Lua:dbk_useKernelmodeProcessMemoryAccess|dbk_useKernelmodeProcessMemoryAccess]]: Switches the internal pointer to the ReadProcessMemory and WriteProcessMemory apis to dbk_ReadProcessMemory and dbk_WriteProcessMemory
+
! Description
* [[Lua:dbk_useKernelmodeQueryMemoryRegions|dbk_useKernelmodeQueryMemoryRegions]]: Switches the internal pointer to the QueryVirtualMemory api to dbk_QueryVirtualMemory
+
|-
* [[Lua:dbk_getPEProcess|dbk_getPEProcess]]: Returns the pointer of the EProcess structure of the selected processid
+
| [[Lua:dbvm_initialize|dbvm_initialize]]
* [[Lua:dbk_getPEThread|dbk_getPEThread]]: Gets the pointer to the EThread structure of a threadid
+
| Initializes the DBVM hypervisor functions for use.
* [[Lua:dbk_readMSR|dbk_readMSR]]: Reads the msr using the dbk driver
+
|}
* [[Lua:dbk_writeMSR|dbk_writeMSR]]: Writes the msr using the dbk driver
 
* [[Lua:dbk_executeKernelMemory|dbk_executeKernelMemory]]: Executes a routine from kernelmode (e.g a routine written there with auto assembler)
 
* [[Lua:dbk_getCR0|dbk_getCR0]]: Returns Control Register 0
 
* [[Lua:dbk_getCR3|dbk_getCR3]]: Returns Control Register 3 of the currently opened process
 
* [[Lua:dbk_getCR4|dbk_getCR4]]: Returns Control Register 4
 
* [[Lua:dbk_getPhysicalAddress|dbk_getPhysicalAddress]]: Returns the physical address of the given address
 
* [[Lua:dbk_writesIgnoreWriteProtection|dbk_writesIgnoreWriteProtection]]: Set to true if you do not wish to initiate copy-on-write behaviour
 
  
 +
==== 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 ==
+
==== MSR and Control Register Access ====
* [[Lua:dbvm_initialize|dbvm_initialize]]: Initializes the dbvm functions
+
{| class="wikitable" style="width:85%;"
* [[Lua:dbvm_addMemory|dbvm_addMemory]]: Adds memory to DBVM
+
! Function
* [[Lua:dbvm_readMSR|dbvm_readMSR]]: Reads the msr using dbvm (bypasses the driver)
+
! Description
* [[Lua:dbvm_writeMSR|dbvm_writeMSR]]: Writes the msr using dbvm (bypasses the driver)
+
|-
* [[Lua:dbvm_getCR4|dbvm_getCR4]]: Returns the real Control Register 4 state
+
| [[Lua:dbvm_readMSR|dbvm_readMSR]]
* [[Lua:dbvm_readPhysicalMemory|dbvm_readPhysicalMemory]]: Reads physical memory using DBVM
+
| Reads a Model-Specific Register (MSR) using DBVM (bypasses driver).
* [[Lua:dbvm_writePhysicalMemory|dbvm_writePhysicalMemory]]: Writes physical memory using DBVM
+
|-
* [[Lua:dbvm_watch_writes|dbvm_watch_writes]]: Starts memory region write monitoring
+
| [[Lua:dbvm_writeMSR|dbvm_writeMSR]]
* [[Lua:dbvm_watch_reads|dbvm_watch_reads]]: Starts memory region read monitoring
+
| Writes a Model-Specific Register (MSR) using DBVM (bypasses driver).
* [[Lua:dbvm_watch_retrievelog|dbvm_watch_retrievelog]]: Receives the result of memory region monitoring
+
|-
* [[Lua:dbvm_watch_disable|dbvm_watch_disable]]: Disables memory region monitoring
+
| [[Lua:dbvm_getCR4|dbvm_getCR4]]
* [[Lua:dbvm_cloak_activate|dbvm_cloak_activate]]: Cloak a page so changes to it will become invisible
+
| Returns the real (unhooked) value of Control Register 4 (CR4).
* [[Lua:dbvm_cloak_deactivate|dbvm_cloak_deactivate]]: Undo the cloak. Also undoes changes
+
|}
* [[Lua:dbvm_cloak_readOriginal|dbvm_cloak_readOriginal]]: Read the memory that gets executed in a cloaked region
 
* [[Lua:dbvm_cloak_writeOriginal|dbvm_cloak_writeOriginal]]: Writes the memory that gets executed in a cloaked region
 
* [[Lua:dbvm_changeregonbp|dbvm_changeregonbp]] : Cloaks and sets a breakpoint at the given address and change registers when executed
 
* [[Lua:dbvm_removechangeregonbp|dbvm_removechangeregonbp]]: Removes a change reg on bp breakpoint
 
* [[Lua:dbvm_log_cr3_start|dbvm_log_cr3_start]] : Start logging CR3 values
 
* [[Lua:dbvm_log_cr3_stop|dbvm_log_cr3_stop]] : Stop logging CR3 values
 
* [[Lua:dbvm_speedhack_setSpeed|dbvm_speedhack_setSpeed]] : sets the systemwide speedhack
 
* [[Lua:dbvm_setTSCAdjust|dbvm_setTSCAdjust]] : Lets you specify what happens when a program tries to detect a virtual machine by calling rdtsc
 
  
== Translation ==
+
==== Memory Monitoring ====
* [[Lua:getTranslationFolder|getTranslationFolder]]: Returns the path of the current translation files, empty if there is no translation going on
+
{| class="wikitable" style="width:85%;"
* [[Lua:loadPOFile|loadPOFile]]: Loads a ''".PO"'' file used for translation
+
! Function
* [[Lua:translate|translate]]: Returns a translation of the string, returns the same string if it can't be found
+
! Description
* [[Lua:translateID|translateID]]: Returns a translation of the string ID
+
|-
 +
| [[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.
 +
|}
  
 +
==== 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.
 +
|}
  
== Files ==
+
==== Breakpoints and Debugging ====
* [[Lua:getFileVersion|getFileVersion]]: Returns the 64-bit file version, and a table that has split up the file version into major, minor, release and build
+
{| class="wikitable" style="width:85%;"
* [[Lua:getFileList|getFileList]]: Returns an indexed table with filenames
+
! Function
* [[Lua:getDirectoryList|getDirectoryList]]: Returns an indexed table with directory names
+
! Description
 +
|-
 +
| [[Lua:dbvm_changeregonbp|dbvm_changeregonbp]]
 +
| Cloaks a page, sets a breakpoint at the given address, and modifies registers when the breakpoint is hit.
 +
|-
 +
| [[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.
 +
|}
  
== Structures ==
+
==== Performance and Anti-Detection ====
* [[Lua:registerStructureDissectOverride|registerStructureDissectOverride]]: same as [[Lua:onAutoGuess|onAutoGuess]], but is called by the structure dissect window when the user chooses to let cheat engine guess the structure for them
+
{| class="wikitable" style="width:85%;"
* [[Lua:unregisterStructureDissectOverride|unregisterStructureDissectOverride]]: unregisters the structure dissect auto guess override
+
! Function
* [[Lua:registerStructureNameLookup|registerStructureNameLookup]]: Registers a function to be called when dissect data asks the user for the name of a new structure define
+
! Description
* [[Lua:unregisterStructureNameLookup|unregisterStructureNameLookup]]:
+
|-
 +
| [[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).
 +
|}
  
 +
=== Translation ===
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:getTranslationFolder|getTranslationFolder]]
 +
| 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).
 +
|}
  
== Miscellaneous ==
+
=== Files ===
* [[Lua:injectDll|injectDll]]: Injects a dll
+
{| class="wikitable" style="width:85%;"
* [[Lua:shellExecute|shellExecute]]: Executes a given command
+
! Function
* [[Lua:executeCode|executeCode]]: Executes a stdcall function with 1 parameter at the given address in the target process and wait for it to return
+
! Description
* [[Lua:executeCodeEx|executeCodeEx]]:
+
|-
* [[Lua:executeCodeLocal|executeCodeLocal]]: Executes a stdcall function with 1 parameter at the given address in the target process
+
| [[Lua:getFileVersion|getFileVersion]]
* [[Lua:executeCodeLocalEx|executeCodeLocalEx]]:
+
| 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:onAPIPointerChange|onAPIPointerChange]]: Registers a callback when an api pointer is changed
+
|-
* [[Lua:setAPIPointer|setAPIPointer]]: Sets the pointer of the given api to the given address
+
| [[Lua:getFileList|getFileList]]
* [[Lua:md5memory|md5memory]]: Returns a md5 sum calculated from the provided memory
+
| Returns an indexed table (array) of filenames in the specified directory.
* [[Lua:md5file|md5file]]: Returns a md5 sum calculated from the file
+
|-
* [[Lua:getSystemMetrics|getSystemMetrics]]: Retrieves the specified system metric or system configuration setting [https://msdn.microsoft.com/en-us/library/windows/desktop/ms724385.aspx msdn.microsoft.com/en-us/library/windows/desktop/ms724385.aspx]
+
| [[Lua:getDirectoryList|getDirectoryList]]
* [[Lua:getTickCount|getTickCount]]: Returns the current tickcount since windows was started. Each tick is one millisecond
+
| Returns an indexed table (array) of subdirectory names in the specified directory.
* [[Lua:getUserRegistryEnvironmentVariable|getUserRegistryEnvironmentVariable]]: Returns the environment variable stored in the user registry environment
+
|}
* [[Lua:setUserRegistryEnvironmentVariable|setUserRegistryEnvironmentVariable]]: Sets the environment variable stored in the user registry environment
 
* [[Lua:broadcastEnvironmentUpdate|broadcastEnvironmentUpdate]]: Call this when you've changed the environment variables in the registry
 
* [[Lua:getApplication|getApplication]]: Returns the application object (the titlebar)
 
* [[Lua:getInternet|getInternet]]: Returns an internet class object.  The string provided will be the name of the client provided
 
  
= Classes =
+
=== Structures ===
Besides the above functions, Cheat Engine also implements some classes.
+
{| 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.
 +
|}
  
* [[Lua:Class:Addresslist|Addresslist]]: The addresslist class is a container for memory records
+
=== Miscellaneous ===
* [[Lua:Class:Bitmap|Bitmap]]: Bitmap based Graphic object
+
{| class="wikitable" style="width:85%;"
* [[Lua:Class:Brush|Brush]]: The brush class is part of the Canvas object. It's used to fill surfaces
+
! Function
* [[Lua:Class:Button|Button]]: The button class is a visual component in the shape of a button.
+
! Description
* [[Lua:Class:ButtonControl|ButtonControl]]: Common ancestor of several button like objects.
+
|-
* [[Lua:Class:Canvas|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
+
| [[Lua:injectDll|injectDll]]
* [[Lua:Class:Calendar|Calendar]]:
+
| Injects a DLL into the currently opened process.
* [[Lua:Class:CEForm|CEForm]]:
+
|-
* [[Lua:Class:CheatComponent|CheatComponent]]: The cheatcomponent class is the component used in Cheat Engine 5.x trainers
+
| [[Lua:shellExecute|shellExecute]]
* [[Lua:Class:CheckBox|CheckBox]]: The Checkbox is a visual component that lets the user click it and change state between checked, unchecked, and if possible, grayed
+
| Executes a given command or opens a file/URL using the system shell.
* [[Lua:Class:Component|Component]] : Base class for all components that need owner-owned functionality.
+
|-
* [[Lua:Class:Control|Control]] : Base class for visible controls.
+
| [[Lua:executeCode|executeCode]]
* [[Lua:Class:Collection|Collection]]: The Collection class is an abstract class that the ListColumns class implements (And perhaps other classes as well)
+
| Executes a stdcall function at a given address in the target process with one parameter and waits for it to return.
* [[Lua:Class:CollectionItem|CollectionItem]]:  Basic object that is managed by a Collection class
+
|-
* [[Lua:Class:ComboBox|ComboBox]]: The Combobox is like an edit field with a ListBox attached to it
+
| [[Lua:executeCodeEx|executeCodeEx]]
* [[Lua:Class:CriticalSection|CriticalSection]]:
+
| Extended version of <code>executeCode</code> (supports more parameters/options).
* [[Lua:Class:CustomControl|CustomControl]]: Base class for windowed controls which paint themselves
+
|-
* [[Lua:Class:CustomType|CustomType]]: The custom type is an convertor of raw data, to a human readable interpretation.
+
| [[Lua:executeCodeLocal|executeCodeLocal]]
* [[Lua:Class:D3DHOOK|D3DHOOK]]: The d3dhook functions provide a method to render graphics and text inside the game, as long as it is running in directx9, 10 or 11
+
| Executes a stdcall function at a given address in Cheat Engine's own process (local execution).
* [[Lua:Class:D3DHook_FontMap|D3DHook_FontMap]]: A fontmap is a texture that contains extra data regarding the characters
+
|-
* [[Lua:Class:D3DHook_Texture|D3DHook_Texture]]: This class controls the texture in memory. Without a sprite to use it, it won't show
+
| [[Lua:executeCodeLocalEx|executeCodeLocalEx]]
* [[Lua:Class:D3Dhook_TextContainer|D3Dhook_TextContainer]]: A d3dhook_sprite class draws a piece of text on the screen based on the used fontmap
+
| Extended version of <code>executeCodeLocal</code> with additional options.
* [[Lua:Class:D3DHook_RenderObject|D3DHook_RenderObject]]: The renderobject is the abstract class used to control in what manner objects are rendered.
+
|-
* [[Lua:Class:D3DHook_Sprite|D3DHook_Sprite]]: A d3dhook_sprite class is a visible texture on the screen
+
| [[Lua:onAPIPointerChange|onAPIPointerChange]]
* [[Lua:Class:Disassembler|Disassembler]]:
+
| Registers a callback invoked when an API pointer is changed (allows reacting to API remapping).
* [[Lua:Class:Disassemblerview|Disassemblerview]]: The visual disassembler used in the memory view window
+
|-
* [[Lua:Class:DisassemblerviewLine|DisassemblerviewLine]]:
+
| [[Lua:setAPIPointer|setAPIPointer]]
* [[Lua:Class:DissectCode|DissectCode]]:
+
| Sets the pointer/address used for a specified API function.
* [[Lua:Class:Edit|Edit]]: The Edit class is a visual component that lets the user type in data (Use control_getCaption to get the user input)
+
|-
* [[Lua:Class:Event|Event]]:
+
| [[Lua:md5memory|md5memory]]
* [[Lua:Class:FileStream|FileStream]]: The FileStream class is a Stream class that is linked to an open file on disk
+
| Computes and returns the MD5 checksum (hex string) of the bytes at the provided memory address/size.
* [[Lua:Class:FileDialog|FileDialog]]:
+
|-
* [[Lua:Class:FindDialog|FindDialog]]:
+
| [[Lua:md5file|md5file]]
* [[Lua:Class:Font|Font]]: Class that defines a font
+
| Computes and returns the MD5 checksum (hex string) of a file's contents.
* [[Lua:Class:Form|Form]]: Class that defines a window
+
|-
* [[Lua:Class:FoundList|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
+
| [[Lua:getSystemMetrics|getSystemMetrics]]
* [[Lua:Class:GenericHotkey|GenericHotkey]]: Lets you register hotkeys to Cheat Engine's internal hotkey handler
+
| Retrieves the specified system metric or configuration setting. See MSDN: <https://msdn.microsoft.com/en-us/library/windows/desktop/ms724385.aspx>.
* [[Lua:Class:Graphic|Graphic]]: Base class for dealing with Graphic images (Abstract)
+
|-
* [[Lua:Class:GraphicControl|GraphicControl]]: Class that supports simple lightweight controls that do not need the ability to accept keyboard input or contain other controls.  
+
| [[Lua:getTickCount|getTickCount]]
* [[Lua:Class:GroupBox|GroupBox]]: The groupbox class is like a Panel, but then has a header on top
+
| Returns the tick count in milliseconds since the system started.
* [[Lua:Class:Hexadecimal|Hexadecimal]]: The visual hexadecimal object used on the memory view window
+
|-
* [[Lua:Class:Hexadecimalview|Hexadecimalview]]: The visual hexadecimal object used on the memory view window
+
| [[Lua:getUserRegistryEnvironmentVariable|getUserRegistryEnvironmentVariable]]
* [[Lua:Class:Icon|Icon]]:
+
| Reads an environment variable stored in the current user's registry environment.
* [[Lua:Class:Image|Image]]: The Image class is a visual component that lets you show an image
+
|-
* [[Lua:Class:Internet|Internet]]:
+
| [[Lua:setUserRegistryEnvironmentVariable|setUserRegistryEnvironmentVariable]]
* [[Lua:Class:JpegImage|JpegImage]]:
+
| Writes an environment variable to the current user's registry environment.
* [[Lua:Class:Label|Label]]: The Label class is a visual component that lets you display text
+
|-
* [[Lua:Class:LuaPipe|LuaPipe]]: Abstract class that [[Lua:Class:LuaPipeServer|LuaPipeServer]] and [[Lua:Class:LuaPipeclient|LuaPipeclient]] inherit from
+
| [[Lua:broadcastEnvironmentUpdate|broadcastEnvironmentUpdate]]
* [[Lua:Class:LuaPipeClient|LuaPipeClient]]: Class implementing a client that connects to a pipe
+
| Broadcasts a notification that environment variables were changed (call after setting registry variables).
* [[Lua:Class:LuaPipeServer|LuaPipeServer]]: Class launching the server side of a pipe
+
|-
* [[Lua:Class:ListBox|ListBox]]: The listbox class is a visual component with a list of selectable strings
+
| [[Lua:getApplication|getApplication]]
* [[Lua:Class:ListColumn|ListColumn]]: The listcolumn class is an implemented CollectionItem class which is used by the ListColumns class of the listview class
+
| Returns the application object (main application/titlebar context).
* [[Lua:Class:ListColumns|ListColumns]]: The ListColumns class contains the Column class objects of a ListView object
+
|-
* [[Lua:Class:ListItem|ListItem]]: The ListItem class object is an entry in a ListView
+
| [[Lua:getInternet|getInternet]]
* [[Lua:Class:ListItems|ListItems]]: The listItems class is a container for the ListItem class objects of a Listview
+
| Returns an Internet client class object. The provided string specifies the client name/type.
* [[Lua:Class:Listview|Listview]]: The listview class lets you have a listbox like component with resizable columns
+
|}
* [[Lua:Class:MainMenu|MainMenu]]: The menu at the top of a form
 
* [[Lua:Class:Memo|Memo]]: The Memo class is a multiline edit field
 
* [[Lua:Class:MemScan|MemScan]]: The memscan class is the memory scanner of Cheat engine
 
* [[Lua:Class:Menu|Menu]]: Common Class ancestor for the MainMenu and PopupMenu classes
 
* [[Lua:Class:MenuItem|MenuItem]]: Holds the menuitems of a Menu, PopupMenu or even another MenuItem
 
* [[Lua:Class:MemoryRecord|MemoryRecord]]: The Memoryrecord class object describes a Cheat Table's Cheat Entry.
 
* [[Lua:Class:MemoryRecordHotkey|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
 
* [[Lua:Class:MemoryStream|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
 
* [[Lua:Class:Memoryview|Memoryview]]: The memoryview class is the Memory view window of Cheat Engine. Use this as a basis to access the objects inside this window
 
* [[Lua:Class:MultiReadExclusiveWriteSynchronizer|MultiReadExclusiveWriteSynchronizer]]:
 
* [[Lua:Class:Object|Object]]: Most basic class. All classes inherit from this class
 
* [[Lua:Class:PaintBox|PaintBox]]:
 
* [[Lua:Class:PageControl|PageControl]]: This is an object that can hold multiple pages
 
* [[Lua:Class:Panel|Panel]]: The Panel class is like a form which can contain visual components.
 
* [[Lua:Class:Pen|Pen]]: The Pen class is part of the Canvas object. It's used to draw lines
 
* [[Lua:Class:Picture|Picture]]: Container for the Graphic class
 
* [[Lua:Class:PopupMenu|PopupMenu]]: The menu that shows when rightclicking on an object
 
* [[Lua:Class:PortableNetworkGraphic|PortableNetworkGraphic]]:
 
* [[Lua:Class:ProgressBar|ProgressBar]]: The progressbar class is a visual representation for a bar that can show the current progress on something
 
* [[Lua:Class:RadioGroup|RadioGroup]]: The radiogroup is like a GroupBox but autopopulated using the Items(Strings object)
 
* [[Lua:Class:RasterImage|RasterImage]]: Base class for some graphical controls
 
* [[Lua:Class:RIPRelativeScanner|RIPRelativeScanner]]:
 
* [[Lua:Class:OpenDialog|OpenDialog]]: The OpenDialog class is used for selecting files to open.
 
* [[Lua:Class:SaveDialog|SaveDialog]]: The SaveDialog class is based on the OpenDialog class but is used to select a file for saving
 
* [[Lua:Class:SelectDirectoryDialog|SelectDirectoryDialog]]:
 
* [[Lua:Class:Semaphore|Semaphore]]:
 
* [[Lua:Class:Settings|Settings]]: This class can be used to read out and set settings of cheat engine and of plugins, and store your own data
 
* [[Lua:Class:Splitter|Splitter]]: The Splitter class is a visual component that lets the user re-size neighboring components)
 
* [[Lua:Class:Stringlist|Stringlist]]: Class that holds a list of strings
 
* [[Lua:Class:Strings|Strings]]: Abstract class that some text based classes make use of
 
* [[Lua:Class:StringStream|StringStream]]:
 
* [[Lua:Class:Structure|Structure]]:
 
* [[Lua:Class:StructureElement|StructureElement]]:
 
* [[Lua:Class:StructureFrm|StructureFrm]]:
 
* [[Lua:Class:structGroup|structGroup]]:
 
* [[Lua:Class:SymbolList|SymbolList]]: This class can be used to look up an address to a symbolname, and a symbolname to an address
 
* [[Lua:Class:TabSheet|TabSheet]]: Part of a page control
 
* [[Lua:Class:TableFile|TableFile]]: Tablefiles are files stored into a Cheat Table. You can access the data of such a file using this class
 
* [[Lua:Class:Thread|Thread]]:
 
* [[Lua:Class:Timer|Timer]]: The timer class is an non visual component that when active triggers an onTimer event every few milliseconds, based on the given interval
 
* [[Lua:Class:ToggleBox|ToggleBox]]: The togglebox is like a button, but can stay down. Use with the checkbox methods
 
* [[Lua:Class:TrackBar|TrackBar]]: The trackbar class is a slider you can drag arround and read/set the state
 
* [[Lua:Class:TreeNode|TreeNode]]:
 
* [[Lua:Class:TreeNodes|TreeNodes]]:
 
* [[Lua:Class:Treeview|Treeview]]:
 
* [[Lua:Class:WinControl|WinControl]]: Base class for controls which can contain other controls.
 
* [[Lua:Class:xmplayer|xmplayer]]:
 
  
 +
== 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 ==
+
=== SQL Classes ===
* [[Lua:SQL:CustomConnection|CustomConnection]]:
+
{| class="wikitable" style="width:85%;"
* [[Lua:SQL:Database|Database]]:
+
! Class
* [[Lua:SQL:SQLConnection|SQLConnection]]:
+
! Short description
* [[Lua:SQL:SQLite3Connection|SQLite3Connection]]:
+
|-
* [[Lua:SQL:ODBCConnection|ODBCConnection]]:
+
| [[Lua:SQL:CustomConnection|CustomConnection]]
* [[Lua:SQL:DBTransaction|DBTransaction]]:
+
| Base for custom DB connection implementations.
* [[Lua:SQL:SQLTransaction|SQLTransaction]]:
+
|-
* [[Lua:SQL:Param|Param]]:
+
| [[Lua:SQL:Database|Database]]
* [[Lua:SQL:Params|Params]]:
+
| Database container/manager for connections and datasets.
* [[Lua:SQL:Fields|Fields]]:
+
|-
* [[Lua:SQL:Dataset|Dataset]]:
+
| [[Lua:SQL:SQLConnection|SQLConnection]]
* [[Lua:SQL:DBDataset|DBDataset]]:
+
| Generic SQL connection abstraction.
* [[Lua:SQL:CustomBufDataset|CustomBufDataset]]:
+
|-
* [[Lua:SQL:CustomSQLQuery|CustomSQLQuery]]:
+
| [[Lua:SQL:SQLite3Connection|SQLite3Connection]]
* [[Lua:SQL:SQLQuery|SQLQuery]]:
+
| 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.
 +
|}
  
 +
=== Class Helper Functions ===
 +
{| class="wikitable" style="width:85%;"
 +
! Function
 +
! Description
 +
|-
 +
| [[Lua:inheritsFromObject|inheritsFromObject]]
 +
| Returns <code>true</code> if the given object/class inherits from <code>Object</code>.
 +
|-
 +
| [[Lua:inheritsFromComponent|inheritsFromComponent]]
 +
| Returns <code>true</code> if the object/class inherits from <code>Component</code>.
 +
|-
 +
| [[Lua:inheritsFromControl|inheritsFromControl]]
 +
| Returns <code>true</code> if the object/class inherits from <code>Control</code>.
 +
|-
 +
| [[Lua:inheritsFromWinControl|inheritsFromWinControl]]
 +
| Returns <code>true</code> if the object/class inherits from <code>WinControl</code>.
 +
|-
 +
| [[Lua:createClass|createClass]]
 +
| Creates an instance of the specified registered class (default constructor).
 +
|-
 +
| [[Lua:createComponentClass|createComponentClass]]
 +
| Creates an instance of the specified component class (owner/parent may be required).
 +
|}
  
== Class Helper Functions ==
+
=== Undefined Class Property Functions ===
* [[Lua:inheritsFromObject|inheritsFromObject]]: Returns true if given any class
+
Not all class properties are explicitly exposed; these helpers allow dynamic access to published properties and method/event bindings.
* [[Lua:inheritsFromComponent|inheritsFromComponent]]: Returns true if the given object inherits from the Component class
 
* [[Lua:inheritsFromControl|inheritsFromControl]]: Returns true if the given object inherits from the Control class
 
* [[Lua:inheritsFromWinControl|inheritsFromWinControl]]: Returns true if the given object inherits from the WinControl class
 
* [[Lua:createClass|createClass]]: Creates an object of the specified class (Assuming it's a registered class and has a default constructor)
 
* [[Lua:createComponentClass|createComponentClass]]: Creates an object of the specified component inherited class
 
  
== Undefined Class Property Functions ==
+
{| class="wikitable" style="width:85%;"
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)
+
! 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.
 +
|}
  
* [[Lua:getPropertyList|getPropertyList]]: Returns a [[Lua:Class:StringList|StringList]] object containing all the published properties of the specified class
+
{{NeedWork}}
* [[Lua:setProperty|setProperty]]: Sets the value of a published property of a class (Won't work for method properties)
 
* [[Lua:getProperty|getProperty]]: Gets the value of a published property of a class (Won't work for method properties)
 
* [[Lua:setMethodProperty|setMethodProperty]]: Sets the method property to the specific function
 
* [[Lua:getMethodProperty|getMethodProperty]]: Returns a function you can use to call the original function
 

Revision as of 15:24, 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

Globals

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)

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

Cheat Table

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

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

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

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

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

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

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

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

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

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

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

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

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

Encoding/Decoding

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

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

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

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

Keyboard & Mouse

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

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

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

Screen

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

General Audio

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

Text-to-Speech

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

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

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

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

Functions for managing and controlling Cheat Engine itself.

Version and Information

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

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

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

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

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

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

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

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

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

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

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

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

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

Commands & Hooks

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

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

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

Status and Information

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

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

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

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

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)

Functions for kernel-mode operations via the DBK driver.

Initialization and Setup

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

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

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

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

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

Initialization

Function Description
dbvm_initialize Initializes the DBVM hypervisor functions for use.

Memory Operations

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

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

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

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

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

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

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

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

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

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

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: <https://msdn.microsoft.com/en-us/library/windows/desktop/ms724385.aspx>.
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

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

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

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

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.