Difference between revisions of "Lua"

From Cheat Engine
Jump to navigation Jump to search
(Initial draft)
 
(Screen)
 
(43 intermediate revisions by 14 users not shown)
Line 1: Line 1:
Cheat Engine comes with an extensive set of Lua functions you can use inside cheattables, trainers and standalone scripts.
+
<!-- Updated to 6.7 celua.text TheyCallMeTim13 -->
 +
[[Category:Lua]]
 +
Cheat Engine comes with an extensive set of Lua functions you can use inside cheat tables, trainers and standalone scripts.
  
* [[readBytes]]: Returns the bytes at the given address. If ReturnAsTable is true it will return a table instead of multiple bytes
 
* [[writeBytes]]: Write the given bytes to the given address from a table
 
* [[readBytesLocal]]: See readBytes but then it's for Cheat engine's memory
 
* [[writeBytesLocal]]: See writeBytes but then it's for Cheat Engine's memory
 
* [[readInteger]]: Reads a integer from the specified address
 
* [[readFloat]]: Reads a single precision floating point value from the specified address
 
* [[readDouble]]: Reads a double precision floating point value from the specified address
 
* [[readString]]: Reads a string from memory untill it ghits a 0-terminator. maxlength is just so you won't freeze for too long
 
* [[writeInteger]]: Writes an integer to the specified address. Returns true on success
 
* [[writeFloat]]: Writes a single precision floating point to the specified address. Returns true on success
 
* [[writeDouble]]: Writes a double precision floating point to the specified address. Returns true on success
 
* [[writeString]]: Write a string to the specified address. Returns true on success
 
* [[getAddress]]: Returns the address of a symbol. Can be a modulename or an export
 
* [[reinitializeSymbolhandler]]: Reinitializes the symbolhandler. E.g when new modules have been loaded
 
* [[generateAPIHookScript]]: Generates an auto assembler script which will hook the given address when executed
 
* [[autoAssemble]]: Runs the auto assembler with the given text
 
* [[showMessage]]: Shows a messagebox with the given text
 
* [[messageDialog]]: Pops up a messagebox
 
* [[sleep]]: Pauses for the number of specified milliseconds
 
* [[getOpenedProcessID]]: Returns the currently opened process
 
* [[getProcessIDFromProcessName]]: Returns a processid
 
* [[openProcess]]: Causes cheat engine to open the given processname or id
 
* [[getForegroundProcess]]: Returns the processid of the current foreground window
 
* [[pause]]: Pauses the current opened process
 
* [[unpause]]: Resumes the current opened process
 
* [[getPixel]]: Returns the rgb value of the pixel at the specific screen coordinate
 
* [[getMousePos]]: Returns the x,y coordinates of the mouse
 
* [[setMousePos]]: Sets the mouse position
 
* [[isKeyPressed]]: Returns true if the specified key is currently pressed
 
* [[keyDown]]: Causes the key to go into down state
 
  
 +
= Variables =
  
keyUp(key)  
+
== Globals ==
Causes the key to go up
+
* [[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 ==
 +
* [[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
  
doKeyPress(key) 
+
= Functions =
simulates a key press
 
  
 +
== Cheat table ==
 +
These functions help manage the cheat table.
  
shellExecute(command, parameters OPTIONAL, folder OPTIONAL, showcommand OPTIONAL)
+
* [[Lua:getAddressList|getAddressList]]: Returns the cheat table [[Lua:Class:Addresslist|Addresslist]] object
Executes a given command
+
* [[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
  
speedhack_setSpeed(speed)
 
Enabled the speedhack if it was not active yet and sets the given speed
 
  
 +
== Scanning ==
 +
These functions control Cheat Engine's scanning.
  
injectDll(filename)
+
* [[Lua:AOBScan|AOBScan]]: Scans the currently opened process and returns a [[Lua:Class:StringList|StringList]] object containing all the results
Injects a dll, and returns true on success
+
* [[Lua:getCurrentMemscan|getCurrentMemscan]]: Returns the currently active scan session as a [[Lua:Class:MemScan|MemScan]] object
  
  
getCheatEngineDir()  
+
== Process ==
Returns the folder Cheat Engine is located at
+
* [[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
  
  
allocateSharedMemory(name, size)
+
== Threads ==
Creates a shared memory object of the given size if it doesn't exist yet. If size is not given and there is no shared region with this name then the default size of 4096 is used
+
* [[Lua:getCPUCount|getCPUCount]]: Returns the number of CPU's
It then maps this shared memory block into the currently targeted process. It returns the address of mapped region in the target process
+
* [[Lua:getThreadlist|getThreadlist]]: Fills a List object with the threadlist of the currently opened process
 
+
* [[Lua:inMainThread|inMainThread]]: Returns true if the current code is running inside the main thread (6.4+)
beep() 
+
* [[Lua:synchronize|synchronize]]: Calls the given function from the main thread. Returns the return value of the given function
Plays the fabulous beep/ping sound!
+
* [[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
  
  
xmplayer_playXM(filename)
+
== Handles ==
Plays the given filename using the xmplayer
+
* [[Lua:getHandleList|getHandleList]]: Returns a table with all the handles in the system
  
  
xmplayer_playXM(Stream)
+
== Addresses ==
Plays the given memory stream
+
These functions help convert between memory addresses and [[symbol]]s/[[CEAddressString]]s.
  
 +
* [[Lua:getAddress|getAddress]]: Returns the address of a symbol. Can be a modulename or an export
 +
* [[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
 +
* [[Lua:getNameFromAddress|getNameFromAddress]]: Returns the given address in string form, returning the symbol representation if possible
 +
* [[Lua:registerSymbol|registerSymbol]]: Assign the specified symbolname to an address
 +
* [[Lua:unregisterSymbol|unregisterSymbol]]: Remove the name from the address
 +
* [[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:inModule|inModule]]: Returns true if the given address is inside a module
 +
* [[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:errorOnLookupFailure|errorOnLookupFailure]]: Set whether address lookups will throw errors, or just return 0.
 +
* [[Lua:registerSymbolLookupCallback|registerSymbolLookupCallback]]: Registers a function to be called when a a symbol is parsed
 +
* [[Lua:unregisterSymbolLookupCallback|unregisterSymbolLookupCallback]]: Removes the callback
 +
* [[Lua:registerAddressLookupCallback|registerAddressLookupCallback]]: Registers a function to be called when the name of an address is requested
 +
* [[Lua:unregisterAddressLookupCallback|unregisterAddressLookupCallback]]: Removes the callback
 +
* [[Lua:reinitializeDotNetSymbolhandler|reinitializeDotNetSymbolhandler]]: Reinitializes only the DotNet part of the symbol list
  
xmplayer_pause()
 
Pauses the current xm audio file
 
  
 +
== Memory ==
 +
* [[Lua:allocateMemory|allocateMemory]]: Allocates some memory into the target process
 +
* [[Lua:deAlloc|deAlloc]]: Frees allocated memory
 +
* [[Lua:allocateSharedMemory|allocateSharedMemory]]: Creates a shared memory object of the given size if it doesn't exist yet
 +
* [[Lua:createSection|createSection]]: Creates a 'section' in memory
 +
* [[Lua:mapViewOfSection|mapViewOfSection]]: Maps the section to memory
 +
* [[Lua:unMapViewOfSection|unMapViewOfSection]]: Unmaps a section from memory
 +
* [[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:freeKernelMemory|freeKernelMemory]]: Frees the given memory region
 +
* [[Lua:mapMemory|mapMemory]]: Maps a specific address to the usermode context from the given PID to the given PID
 +
* [[Lua:unmapMemory|unmapMemory]]:
 +
* [[Lua:createMemoryStream|createMemoryStream]]:
  
xmplayer_resume()
+
These functions read/write memory from the opened process.
Resumes the current xm audio file
 
  
 +
=== Reading ===
 +
* [[Lua:readBytes|readBytes]]: Returns the bytes at the given address. If ReturnAsTable is true it will return a table instead of multiple bytes
 +
* [[Lua:readSmallInteger|readSmallInteger]]: Reads a 16-bit integer from the specified address.
 +
* [[Lua:readInteger|readInteger]]: Reads a 32-bit integer from the specified address.
 +
* [[Lua:readQword|readQword]]: Reads a 64-bit integer from the specified address.
 +
* [[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:readDouble|readDouble]]: Reads a double precision floating point value from the specified address
 +
* [[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
  
xmplayer_stop()
+
* [[Lua:readBytesLocal|readBytesLocal]]: See readBytes but then it's for Cheat engine's memory
Stops the current xm audio file
+
* [[Lua:readSmallIntegerLocal|readSmallIntegerLocal]]: Reads a 16-bit integer from the specified address in CE's memory
 +
* [[Lua:readIntegerLocal|readIntegerLocal]]: Reads a 32-bit integer from the specified address in CE's memory
 +
* [[Lua:readQwordLocal|readQwordLocal]]: Reads a 64-bit integer from the specified address in CE's memory
 +
* [[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:readDoubleLocal|readDoubleLocal]]: Reads a double precision floating point value from the specified address in CE's memory
 +
* [[Lua:readStringLocal|readStringLocal]]: Reads a string from CE's memory until it hits a 0-terminator
  
  
xmplayer_isPlaying()
+
=== Writing ===
Returns true if there is current an xm audio file being played
+
* [[Lua:writeBytes|writeBytes]]: Write the given bytes to the given address from a table
 +
* [[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]]: 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:writeDouble|writeDouble]]: Writes a double precision floating point to the specified address. Returns true on success.
 +
* [[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:writeSmallIntegerLocal|writeSmallIntegerLocal]]: Writes a 16-bit integer to the specified address in CE's memory. Returns true on success
 +
* [[Lua:writeIntegerLocal|writeIntegerLocal]]: Writes a 32-bit integer to the specified address in CE's memory. Returns true on success
 +
* [[Lua:writeQwordLocal|writeQwordLocal]]: Writes a 64-bit integer to the specified address in CE's memory. Returns true on success
 +
* [[Lua:writeFloatLocal|writeFloatLocal]]: Writes a single precision floating point to the specified address in CE's memory. Returns true on success
 +
* [[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:writeBytesLocal|writeBytesLocal]]: See writeBytes but then it's for Cheat Engine's memory
  
writeRegionToFile(filename, sourceaddress,size) 
+
** [[Lua:readSmallInteger|readSmallInteger]], [[Lua:readInteger|readInteger]], [[Lua:readSmallIntegerLocal|readSmallIntegerLocal]], [[Lua:readIntegerLocal|readIntegerLocal]] can also have second boolean parameter. If true, value will be signed.
Writes the given region to a file. Returns the number of bytes written
 
  
 +
== 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
  
readRegionFromFile(filename, destinationaddress)
+
=== To Byte Table ===
Writes the given file to a specific address
+
* [[Lua:wordToByteTable|wordToByteTable]]: Converts a word to a bytetable
 +
* [[Lua:dwordToByteTable|dwordToByteTable]]: Converts a dword to a bytetable
 +
* [[Lua:qwordToByteTable|qwordToByteTable]]: Converts a qword to a bytetable
 +
* [[Lua:floatToByteTable|floatToByteTable]]: Converts a float to a bytetable
 +
* [[Lua:doubleToByteTable|doubleToByteTable]]: Converts a double to a bytetable
 +
* [[Lua:stringToByteTable|stringToByteTable]]: Converts a string to a bytetable
 +
* [[Lua:wideStringToByteTable|wideStringToByteTable]]: Converts a string to a widestring and converts that to a bytetable
  
 +
=== From Byte Table ===
 +
* [[Lua:byteTableToWord|byteTableToWord]]: Converts a bytetable to a word
 +
* [[Lua:byteTableToDword|byteTableToDword]]: Converts a bytetable to a dword
 +
* [[Lua:byteTableToQword|byteTableToQword]]: Converts a bytetable to a qword
 +
* [[Lua:byteTableToFloat|byteTableToFloat]]: Converts a bytetable to a float
 +
* [[Lua:byteTableToDouble|byteTableToDouble]]: Converts a bytetable to a double
 +
* [[Lua:byteTableToString|byteTableToString]]: Converts a bytetable to a string
 +
* [[Lua:byteTableToWideString|byteTableToWideString]]: Converts a bytetable to a widestring and converts that to a string
  
resetLuaState()
 
This will create a new lua state that will be used. (Does not destroy the old one, so memory leak)
 
  
 +
=== Binary ===
 +
* [[Lua:bOr|bOr]]: Binary Or
 +
* [[Lua:bXor|bXor]]: Binary Xor
 +
* [[Lua:bAnd|bAnd]]: Binary And
 +
* [[Lua:bShl|bShl]]: Binary shift left
 +
* [[Lua:bShr|bShr]]: Binary shift right
 +
* [[Lua:bNot|bNot]]: Binary not
  
registerSymbol(symbolname, address)
+
== Input devices ==
Assign the specified symbolname to an address
+
These functions get/set keyboard/mouse input.
  
 +
* [[Lua:getMousePos|getMousePos]]: Returns the ''X'' and ''Y'' coordinates of the mouse
 +
* [[Lua:setMousePos|setMousePos]]: Sets the mouse position
 +
* [[Lua:isKeyPressed|isKeyPressed]]: Returns true if the specified key is currently pressed
 +
* [[Lua:keyDown|keyDown]]: Causes the key to go into down state
 +
* [[Lua:keyUp|keyUp]]: Causes the key to go up
 +
* [[Lua:doKeyPress|doKeyPress]]: Simulates a key press
 +
* [[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]
 +
* [[Lua:setGlobalKeyPollInterval|setGlobalKeyPollInterval]]: Sets the global keypoll interval
 +
* [[Lua:setGlobalDelayBetweenHotkeyActivation|setGlobalDelayBetweenHotkeyActivation]]: Sets the minimum delay between the activation of the same hotey in milliseconds
  
unregisterSymbol(symbolname)
+
=== Game Controller ===
Remove the name from the address
+
* [[Lua:getXBox360ControllerState|getXBox360ControllerState]]: Fetches the state of the connected XBox controller
 +
* [[Lua:setXBox360ControllerVibration|setXBox360ControllerVibration]]: Sets the speed of the left and right vibrating motor inside the controller
  
 +
=== Clipboard ===
 +
* [[Lua:writeToClipboard|writeToClipboard]]: Writes the given text to the clipboard
 +
* [[Lua:readFromClipboard|readFromClipboard]]: Reads the text from the clipboard
  
getNameFromAddress(address)
 
Returns the given address in string form, returning the symbol representation if possible
 
  
 +
== Screen ==
 +
* [[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
  
inModule(address)
+
== Sounds ==
Returns true if the given address is inside a module
+
* [[Lua:playSound|playSound]]: Plays a sound file
 +
* [[Lua:beep|beep]]: Plays the fabulous beep/ping sound!
 +
* [[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]
 +
* [[Lua:speakEnglish|speakEnglish]]: Will try the English voice by wrapping the given text into an XML statement specifying the English voice
  
 +
=== xmplayer ===
 +
* [[Lua:xmplayer_playXM|xmplayer_playXM]]: Plays the given filename using the xmplayer
 +
* [[Lua:xmplayer_pause|xmplayer_pause]]: Pauses the current xm audio file
 +
* [[Lua:xmplayer_resume|xmplayer_resume]]: Resumes the current xm audio file
 +
* [[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
  
inSystemModule(address)
+
== Text to Speech ==
Returns true if the given address is inside a system module
+
* [[Lua:speak|speak]]: Speaks a given text.
 +
* [[Lua:speakEnglish|speakEnglish]]: Speaks a given text with English voice.
  
  
getCommonModuleList()
+
== Fonts ==
Returns the commonModuleList StringList object. (Do not free this one)
 
You can use it to add or remove modules you do not want to scan by routines like dissect code and the pointerscan
 
  
 +
* [[Lua:loadFontFromStream|loadFontFromStream]]: Loads a font from a memory stream and returns an id (handle) to the font for use with [[unloadLoadedFont]]
 +
* [[Lua:unloadLoadedFont|unloadLoadedFont]]: Unloads a font from a memory stream
  
cheatEngineIs64Bit()
 
Returns true if CE is 64-bit, false if 32-bit
 
  
 +
== Forms and Windows ==
  
targetIs64Bit()
+
* [[Lua:findWindow|findWindow]]: Finds a window with the given classname and/or windowname
Returns true if the target process is 64-bit, false if 32-bit
+
* [[Lua:getWindow|getWindow]]: Gets a specific window based on the given window (Check MSDN getWindow for the command description)
 +
* [[Lua:getWindowCaption|getWindowCaption]]: Returns the caption of the window
 +
* [[Lua:getWindowClassName|getWindowClassName]]: Returns the classname of the window
 +
* [[Lua:getWindowProcessID|getWindowProcessID]]: Returns the processid of the process this window belongs to
 +
* [[Lua:getForegroundWindow|getForegroundWindow]]: Returns the windowhandle of the topmost window
 +
* [[Lua:sendMessage|sendMessage]]: Sends a message to a window
 +
* [[Lua:hookWndProc|hookWndProc]]: Hooks a window's wndproc procedure
 +
* [[Lua:unhookWndProc|unhookWndProc]]: Called when done with the hook from [[Lua:hookWndProc|hookWndProc]]
  
  
registerCustomTypeLua(typename, bytecount, bytestovaluefunction, valuetobytesfunction)
+
== Cheat Engine ==
Registers a Custom type based on lua functions
+
These functions help manage Cheat Engine itself.
  The bytes to value function should be defined as "function bytestovalue (b1,b2,b3,b4)" and return an integer as result
 
  The value to bytes function should be defined as "function valuetobytes (integer)" and return the bytes it should write
 
  
 +
* [[Lua:getCEVersion|getCEVersion]]: Returns a floating point value specifying the version of cheat engine
 +
* [[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
 +
* [[Lua:getFreezeTimer|getFreezeTimer]]: Returns the Timer object responsible for freezing values
 +
* [[Lua:getUpdateTimer|getUpdateTimer]]: Returns the Timer object responsible for updating the value list
 +
* [[Lua:getCommonModuleList|getCommonModuleList]]: Returns the commonModuleList [[Lua:Class:StringList|StringList]] object
 +
* [[Lua:getCheatEngineProcessID|getCheatEngineProcessID]]: Returns the processid of cheat engine
 +
* [[Lua:cheatEngineIs64Bit|cheatEngineIs64Bit]]: Returns true if Cheat Engine is 64-bit, false if 32-bit
 +
* [[Lua:closeCE|closeCE]]: Closes Cheat Engine
 +
* [[Lua:getAutoAttachList|getAutoAttachList]]: Returns the AutoAttach [[Lua:Class:StringList|StringList]] object
 +
* [[Lua:connectToCEServer|connectToCEServer]]: Connects to the given host and port. On success, most commands subsequent will be handled by the server
 +
* [[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:getCheatEngineDir|getCheatEngineDir]]: Returns the folder Cheat Engine (or the trainer) is located at.
 +
* [[Lua:getComment|getComment]]: Gets the userdefined comment at the specified address
 +
* [[Lua:setComment|setComment]]: Sets a userdefined comment at the specifried address
 +
* [[Lua:getHeader|getHeader]]: Gets the userdefined header at the specified address
 +
* [[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 ===
 +
* [[Lua:getFormCount|getFormCount]]: Returns the total number of forms assigned to the main CE application
 +
* [[Lua:getForm|getForm]]: Returns the form at the specific index
 +
* [[Lua:getMemoryViewForm|getMemoryViewForm]]: Returns the first Memoryview form class object
 +
* [[Lua:getMainForm|getMainForm]]: Returns the first Mainform class object
 +
* [[Lua:getSettingsForm|getSettingsForm]]: Returns the main settings form
 +
* [[Lua:getLuaEngine|getLuaEngine]]: Returns the lua engine form object (Creates it if needed)
 +
* [[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 ===
 +
* [[Lua:showMessage|showMessage]]: Shows a message box with the given text
 +
* [[Lua:messageDialog|messageDialog]]: Pops up a message box
 +
* [[Lua:outputDebugString|outputDebugString]]: Outputs a message using the windows OutputDebugString message
 +
* [[Lua:processMessages|processMessages]]: Lets the main eventhandler process the new messages (allows for new button clicks)
  
registerCustomTypeAutoAssembler(typename, bytecount, script)
+
=== Input ===
Registers a custom type based on an auto assembler script. The script must allocate an "ConvertRoutine" and "ConvertBackRoutine"
+
* [[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+)
  
 +
=== Shortcuts ===
 +
* [[Lua:shortCutToText|shortCutToText]]: Returns the textual representation of the given shortcut value (integer) (6.4+)
 +
* [[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
  
onAutoGuess(function)
+
=== Speed Hack ===
Registers an function to be called whenever autoguess is used to predict a variable type
+
* [[Lua:speedhack_setSpeed|speedhack_setSpeed]]: Enables the speed hack if it was not active yet and sets the given speed
function override (address, ceguess): Return the variable type you want it to be. If no change, just return ceguess
+
* [[Lua:speedhack_getSpeed|speedhack_getSpeed]]: Returns the last set speed
  
  
 +
== Lua ==
 +
These functions help manage Lua itself.
  
 +
* [[Lua:resetLuaState|resetLuaState]]: This will create a new Lua state that will be used.
 +
* [[Lua:sleep|sleep]]: Pauses for the number of specified milliseconds
 +
* [[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
  
  
 +
== Types ==
 +
These functions help structure a process's memory into datatypes.
  
 +
* [[Lua:onAutoGuess|onAutoGuess]]: Registers an function to be called whenever autoguess is used to predict a variable type.
 +
* [[Lua:registerCustomTypeLua|registerCustomTypeLua]]: Registers a [[custom type]] based on Lua functions.
 +
* [[Lua:registerCustomTypeAutoAssembler|registerCustomTypeAutoAssembler]]: Registers a custom type based on an auto assembler script.
  
  
Debugging
+
== Object-oriented ==
 +
These functions determine how a Lua object fits in the class hierarchy.
  
 +
* [[Lua:inheritsFromObject|inheritsFromObject]]: Returns true if given any class
 +
* [[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
  
debug variables
 
EFLAGS
 
32-bit EAX, EBX, ECX, EDX, EDI, ESP, EBP, ESP, EIP
 
64-bit RAX, EBX, RBX, RDX, RDI, RSP, RBP, RSP, RIP, R8, R9, R10, R11, R12, R13, R14, R15  The value of the register
 
  
 +
== Assembly ==
  
Debug related routines
+
These functions help work with the x86 machine code as assembly.
function debugger_onBreakpoint()
 
When a breaking breakpoint hits (that includes single stepping) and the lua function debugger_onBreakpoint() is defined it will be called and the global variables EAX, EBX, .... will be filled in
 
Return 0 if you want the userinterface to be updated and anything else if not (e.g You continued from the breakpoint in your script)
 
  
 +
* [[Lua:autoAssemble|autoAssemble]]: Runs the auto assembler with the given text
 +
* [[Lua:autoAssembleCheck|autoAssembleCheck]]: Checks the script for syntax errors. Returns true on succes, false with an error message on failure
 +
* [[Lua:disassemble|disassemble]]: Disassembles the given address and returns a string in the format of "address - bytes - opcode  extra"
 +
* [[Lua:splitDisassembledString|splitDisassembledString]]: Returns 4 strings. The address, bytes, opcode and extra field
 +
* [[Lua:getInstructionSize|getInstructionSize]]: Returns the size of an instruction
 +
* [[Lua:getPreviousOpcode|getPreviousOpcode]]: Returns the address of the previous opcode (guess)
 +
* [[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
 +
* [[Lua:unregisterAssembler|unregisterAssembler]]: Unregisters the registered assembler
  
  
 +
== Auto Assembler ==
 +
* [[Lua:registerAutoAssemblerCommand|registerAutoAssemblerCommand]]: Registers an auto assembler command to call the specified function
 +
* [[Lua:unregisterAutoAssemblerCommand|unregisterAutoAssemblerCommand]]: Unregisters an auto assembler command
 +
* [[Lua:registerAutoAssemblerPrologue|registerAutoAssemblerPrologue]]: Registers a function to be called when the auto assembler is about to parse an auto assembler script
 +
* [[Lua:unregisterAutoAssemblerPrologue|unregisterAutoAssemblerPrologue]]: Unregisters an auto assembler prologue
 +
* [[Lua:fullAccess|fullAccess]]: Changes the protection of a block of memory to writable and executable
  
createProcess(path, parameters OPTIONAL, debug OPTIONAL, breakonentrypoint OPTIONAL) 
 
Creates a process. If debug is true it will be created using the windows debugger and if breakonentry is true it will cause a breakpoint to occur on entrypoint
 
  
 +
=== Scripts ===
 +
* [[Lua:registerAutoAssemblerTemplate|registerAutoAssemblerTemplate]]: Registers a template for the auto assembler
 +
* [[Lua:unregisterAutoAssemblerTemplate|unregisterAutoAssemblerTemplate]]: Unregisters a template for the auto assembler
 +
* [[Lua:generateCodeInjectionScript|generateCodeInjectionScript]]: Adds a default code injection script to the given script
 +
* [[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:generateAPIHookScript|generateAPIHookScript]]: Generates an auto assembler script which will hook the given address when executed
  
debugProcess(interface OPT)
 
Starts the debugger for the currently opened process (won't ask the user)
 
  Optional interface 0=default, 1=windows debug, 2=VEHDebug, 3=Kerneldebug
 
  
 +
== Debugger ==
 +
These functions manage the debugger. See ''[[Lua Debugging]]''.
  
debug_setBreakpoint(address, size OPTIONAL, trigger OPTIONAL)
+
* [[Lua:debug_isDebugging|debug_isDebugging]]: Returns true if the debugger has been started
Sets a breakpoint of a specific size at the given address. if trigger is bptExecute then size is ignored. If trigger is ignored then it will be of type bptExecute, which obviously also ignores the size then as well
+
* [[Lua:debug_getCurrentDebuggerInterface|debug_getCurrentDebuggerInterface]]: Returns the current debuggerinterface used (1=windows, 2=VEH 3=Kernel, nil=no debugging active)
 +
* [[Lua:debug_canBreak|debug_canBreak]]: Returns true if there is a possibility the target can stop on a breakpoint. 6.4+
 +
* [[Lua:debug_isBroken|debug_isBroken]]: Returns true if the debugger is currently halted on a thread
 +
* [[Lua:debug_getBreakpointList|debug_getBreakpointList]]: Returns a lua table containing all the breakpoint addresses
 +
* [[Lua:debugProcess|debugProcess]]: Debugs the currently attached process
 +
* [[Lua:debug_setBreakpoint|debug_setBreakpoint]]: Sets a breakpoint of a specific size at the given address
 +
* [[Lua:debugger_onBreakpoint|debugger_onBreakpoint]]: Called by CE when a breakpoint hits (userdefined)
 +
* [[Lua:debug_removeBreakpoint|debug_removeBreakpoint]]: Removes a breakpoint
 +
* [[Lua:debug_continueFromBreakpoint|debug_continueFromBreakpoint]]: Continues the debugger when it's halted on a breakpoint
 +
* [[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:debug_getLastBranchRecord|debug_getLastBranchRecord]]: Returns the value of the Last Branch Record at the given index (when handling a breakpoint)
 +
* [[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
  
  
debug_removeBreakpoint(address)  
+
== DBK ==
If the given address is a part of a breakpoint it will be removed
+
* [[Lua:dbk_initialize|dbk_initialize]]: Loads the DBK driver into memory if possible
 +
* [[Lua:dbk_useKernelmodeOpenProcess|dbk_useKernelmodeOpenProcess]]: Switches the internal pointer of the OpenProcess api to dbk_OpenProcess
 +
* [[Lua:dbk_useKernelmodeProcessMemoryAccess|dbk_useKernelmodeProcessMemoryAccess]]: Switches the internal pointer to the ReadProcessMemory and WriteProcessMemory apis to dbk_ReadProcessMemory and dbk_WriteProcessMemory
 +
* [[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:dbk_getPEThread|dbk_getPEThread]]: Gets the pointer to the EThread structure of a threadid
 +
* [[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
  
  
debug_continueFromBreakpoint(continueMethod)  
+
== DBVM ==
If the debugger is currently waiting to continue you can continue with this.  
+
* [[Lua:dbvm_initialize|dbvm_initialize]]: Initializes the dbvm functions
Valid parameters are
+
* [[Lua:dbvm_addMemory|dbvm_addMemory]]: Adds memory to DBVM
  co_run  just continue
+
* [[Lua:dbvm_readMSR|dbvm_readMSR]]: Reads the msr using dbvm (bypasses the driver)
  co_stepinto when on top of a call, follow it
+
* [[Lua:dbvm_writeMSR|dbvm_writeMSR]]: Writes the msr using dbvm (bypasses the driver)
  co_stepover when on top of a call run till after the call
+
* [[Lua:dbvm_getCR4|dbvm_getCR4]]: Returns the real Control Register 4 state
 +
* [[Lua:dbvm_readPhysicalMemory|dbvm_readPhysicalMemory]]: Reads physical memory using DBVM
 +
* [[Lua:dbvm_writePhysicalMemory|dbvm_writePhysicalMemory]]: Writes physical memory using DBVM
 +
* [[Lua:dbvm_watch_writes|dbvm_watch_writes]]: Starts memory region write monitoring
 +
* [[Lua:dbvm_watch_reads|dbvm_watch_reads]]: Starts memory region read monitoring
 +
* [[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_cloak_activate|dbvm_cloak_activate]]: Cloak a page so changes to it will become invisible
 +
* [[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 ==
 +
* [[Lua:getTranslationFolder|getTranslationFolder]]: Returns the path of the current translation files, empty if there is no translation going on
 +
* [[Lua:loadPOFile|loadPOFile]]: Loads a ''".PO"'' file used for translation
 +
* [[Lua:translate|translate]]: Returns a translation of the string, returns the same string if it can't be found
 +
* [[Lua:translateID|translateID]]: Returns a translation of the string ID
  
Changing registers (Different from ce 6.0)
 
When the debugger is waiting to continue you can change the register variables. When you continue those register values will be set in the thread's context
 
  
 +
== Files ==
 +
* [[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
 +
* [[Lua:getFileList|getFileList]]: Returns an indexed table with filenames
 +
* [[Lua:getDirectoryList|getDirectoryList]]: Returns an indexed table with directory names
  
The following routines describe last branch recording. These functions only work when kernelmode debugging is used and using windows XP (vista and later work less effective or not at all because the operating system interferes.  Might also be intel specific. A dbvm upgrade in the future might make this work for windows vista and later)
 
  
 +
== Structures ==
 +
* [[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
 +
* [[Lua:unregisterStructureDissectOverride|unregisterStructureDissectOverride]]: unregisters the structure dissect auto guess override
 +
* [[Lua:registerStructureNameLookup|registerStructureNameLookup]]: Registers a function to be called when dissect data asks the user for the name of a new structure define
 +
* [[Lua:unregisterStructureNameLookup|unregisterStructureNameLookup]]:
  
debug_setLastBranchRecording(boolean)
 
When set the Kernel debugger will try to record the last branch(es) taken before a breakpoint happens. Set this BEFORE you start the debugger else it will miss the first few LBR records (up to the number of cpu cores you have)
 
  
 +
== Miscellaneous ==
 +
* [[Lua:injectDll|injectDll]]: Injects a dll
 +
* [[Lua:shellExecute|shellExecute]]: Executes a given command
 +
* [[Lua:executeCode|executeCode]]: Executes a stdcall function with 1 parameter at the given address in the target process and wait for it to return
 +
* [[Lua:executeCodeEx|executeCodeEx]]:
 +
* [[Lua:executeCodeLocal|executeCodeLocal]]: Executes a stdcall function with 1 parameter at the given address in the target process
 +
* [[Lua:executeCodeLocalEx|executeCodeLocalEx]]:
 +
* [[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:md5memory|md5memory]]: Returns a md5 sum calculated from the provided memory
 +
* [[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:getTickCount|getTickCount]]: Returns the current tickcount since windows was started. Each tick is one millisecond
 +
* [[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
  
debug_getMaxLastBranchRecord()
+
= Classes =
Returns the maximum branch record your cpu can store (-1 if none)
+
Besides the above functions, Cheat Engine also implements some classes.
  
 +
* [[Lua:Class:Addresslist|Addresslist]]: The addresslist class is a container for memory records
 +
* [[Lua:Class:Bitmap|Bitmap]]: Bitmap based Graphic object
 +
* [[Lua:Class:Brush|Brush]]: The brush class is part of the Canvas object. It's used to fill surfaces
 +
* [[Lua:Class:Button|Button]]: The button class is a visual component in the shape of a button.
 +
* [[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:Class:Calendar|Calendar]]:
 +
* [[Lua:Class:CEForm|CEForm]]:
 +
* [[Lua:Class:CheatComponent|CheatComponent]]: The cheatcomponent class is the component used in Cheat Engine 5.x trainers
 +
* [[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
 +
* [[Lua:Class:Component|Component]] : Base class for all components that need owner-owned functionality.
 +
* [[Lua:Class:Control|Control]] : Base class for visible controls.
 +
* [[Lua:Class:Collection|Collection]]: The Collection class is an abstract class that the ListColumns class implements (And perhaps other classes as well)
 +
* [[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:Class:CriticalSection|CriticalSection]]:
 +
* [[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: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
 +
* [[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:Class:D3Dhook_TextContainer|D3Dhook_TextContainer]]: A d3dhook_sprite class draws a piece of text on the screen based on the used fontmap
 +
* [[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:Class:Disassembler|Disassembler]]:
 +
* [[Lua:Class:Disassemblerview|Disassemblerview]]: The visual disassembler used in the memory view window
 +
* [[Lua:Class:DisassemblerviewLine|DisassemblerviewLine]]:
 +
* [[Lua:Class:DissectCode|DissectCode]]:
 +
* [[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:Class:FileStream|FileStream]]: The FileStream class is a Stream class that is linked to an open file on disk
 +
* [[Lua:Class:FileDialog|FileDialog]]:
 +
* [[Lua:Class:FindDialog|FindDialog]]:
 +
* [[Lua:Class:Font|Font]]: Class that defines a font
 +
* [[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:Class:GenericHotkey|GenericHotkey]]: Lets you register hotkeys to Cheat Engine's internal hotkey handler
 +
* [[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:Class:GroupBox|GroupBox]]: The groupbox class is like a Panel, but then has a header on top
 +
* [[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:Class:Icon|Icon]]:
 +
* [[Lua:Class:Image|Image]]: The Image class is a visual component that lets you show an image
 +
* [[Lua:Class:Internet|Internet]]:
 +
* [[Lua:Class:JpegImage|JpegImage]]:
 +
* [[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:Class:LuaPipeClient|LuaPipeClient]]: Class implementing a client that connects to a pipe
 +
* [[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:Class:ListColumn|ListColumn]]: The listcolumn class is an implemented CollectionItem class which is used by the ListColumns class of the listview class
 +
* [[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:Class:ListItems|ListItems]]: The listItems class is a container for the ListItem class objects of a Listview
 +
* [[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]]:
  
debug_getLastBranchRecord(index)
 
Returns the value of the Last Branch Record at the given index (when handling a breakpoint)
 
  
 +
== SQL Classes ==
 +
* [[Lua:SQL:CustomConnection|CustomConnection]]:
 +
* [[Lua:SQL:Database|Database]]:
 +
* [[Lua:SQL:SQLConnection|SQLConnection]]:
 +
* [[Lua:SQL:SQLite3Connection|SQLite3Connection]]:
 +
* [[Lua:SQL:ODBCConnection|ODBCConnection]]:
 +
* [[Lua:SQL:DBTransaction|DBTransaction]]:
 +
* [[Lua:SQL:SQLTransaction|SQLTransaction]]:
 +
* [[Lua:SQL:Param|Param]]:
 +
* [[Lua:SQL:Params|Params]]:
 +
* [[Lua:SQL:Fields|Fields]]:
 +
* [[Lua:SQL:Dataset|Dataset]]:
 +
* [[Lua:SQL:DBDataset|DBDataset]]:
 +
* [[Lua:SQL:CustomBufDataset|CustomBufDataset]]:
 +
* [[Lua:SQL:CustomSQLQuery|CustomSQLQuery]]:
 +
* [[Lua:SQL:SQLQuery|SQLQuery]]:
  
  
 +
== Class Helper Functions ==
 +
* [[Lua:inheritsFromObject|inheritsFromObject]]: Returns true if given any class
 +
* [[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 ==
 
 
 
 
 
 
 
 
 
 
 
 
 
 
closeCE() 
 
Just closes ce
 
 
 
 
 
hideAllCEWindows() 
 
Makes all normal ce windows invisible (e.g trainer table)
 
 
 
 
 
unhideMainCEwindow()
 
Shows the main cheat engine window
 
 
 
 
 
getAutoAttachList()
 
Returns the AutoAttach StringList object. It can be controlled with the stringlist_ routines (it's not recommended to destroy this list object)
 
 
 
 
 
 
 
 
 
 
 
 
 
supportCheatEngine(attachwindow, hasclosebutton, width, height, position ,yoururl OPTIONAL, extraparameters OPTIONAL, percentageshown OPTIONAL)
 
  Will show an advertising window which will help keep the development of Cheat Engine going.
 
  If you provide your own url it will be shown Up to 75% of the time.
 
 
 
 
 
  attachwindow Type=Form  The form that the ad is attached to
 
  hasclosebutton Type=boolean  If true the window will have a border an a close button at top
 
  width, height Type=integer 
 
    The client width and height of the window.
 
    Prefered formats are  120x600 , 160x600, 300x250, 468x60, 728x90  ,But you are free to use different formats
 
 
 
 
 
  Position Type=integer/enum The place of the window
 
    0=Top, 1=Right, 2=Bottom, 3=left
 
 
 
 
 
  Yoururl Type=string The url you want to show. When given instead of showing CE's ads 100% it will show your url up to 75%.
 
    You can use it for your own income, or for updating users about new versions of your trainer or whatever you feel like
 
 
 
 
 
  Extraparameters Type=String  are url request parameters you can add to the default parameters (e.g trainername=mytrainer for tracking purposes) 
 
 
 
 
 
  PercentageShown You can change the default of 75% to a smaller value like 50%
 
 
 
 
 
 
 
 
 
fuckCheatEngine() 
 
Removes the ad window if it was showing
 
 
 
 
 
function onOpenProcess(processid)
 
When this function is defined it will be called each time a process has been opened (note that a process can be opened multiple times in a row, e.g when attaching the debugger it might first open it and then attach the debugger which opens it again...)
 
 
 
 
 
function debugger_onModuleLoad(modulename, baseaddress) 
 
this routine is called when a module is loaded and the debugger is attached. This only works with the Windows debugger interface.
 
Return 1 if you want to cause the debugger to break on module load
 
 
 
 
 
 
 
 
 
 
 
 
 
Disassembler
 
disassemble(address)
 
Disassembles the given address and returns a string in the format of "address - bytes - opcode  extra"
 
 
 
 
 
splitDisassembledString(disassembledstring) Returns 4 strings. The address, bytes, opcode and extra field
 
 
 
 
 
getInstructionSize(address) Returns the size of an instruction (basically it disassembles the instruction and returns the number of bytes for you)
 
 
 
 
 
getPreviousOpcode(address):
 
Returns the address of the previous opcode (this is just an estimated guess)
 
 
 
 
 
 
 
 
 
Internal Cheat Engine functions
 
The following section describes some of CE's internal functions. Only use them if you know what you are doing.
 
 
 
 
 
dbk_initialize() 
 
Returns true if the dbk driver is loaded in memory. False if it failed for whatever reason (e.g 64-bit and not booted with unsigned driver support)
 
 
 
 
 
dbk_useKernelmodeOpenProcess() 
 
Switches the internal pointer of the OpenProcess api to dbk_OpenProcess
 
 
 
 
 
dbk_useKernelmodeProcessMemoryAccess()
 
Switches the internal pointer to the ReadProcessMemory and WriteProcessMemory apis to dbk_ReadProcessMemory and dbk_WriteProcessMemory
 
 
 
 
 
dbk_useKernelmodeQueryMemoryRegions()
 
Switches the internal pointer to the QueryVirtualMemory api to dbk_QueryVirtualMemory
 
 
 
 
 
dbk_getPEProcess(processid) 
 
Returns the pointer of the EProcess structure of the selected processid
 
 
 
 
 
dbk_getPEThread(threadid) 
 
Gets the pointer to the EThread  structure
 
 
 
 
 
dbk_readMSR(msr)
 
Reads the msr
 
 
 
 
 
dbk_writeMSR(msr, msrvalue)
 
Writes the msr
 
 
 
 
 
dbk_executeKernelMemory(address, parameter) 
 
Executes a routine from kernelmode (e.g a routine written there with auto assembler)
 
parameter can be a value or an address. It's up to your code how it's handled
 
 
 
 
 
 
 
 
 
 
 
 
 
dbvm_initialize(offloados OPTIONAL)
 
Initializes the dbvm functions (dbk_initialize also calls this) offloados is a boolean that when set will offload the system onto dbvm if it's not yet running (and only IF the dbk driver is loaded)
 
 
 
 
 
dbvm_readMSR(msr)
 
See dbk_readMSR
 
 
 
 
 
dbvm_writeMSR(msr, value)
 
See dbk_writeMSR
 
 
 
 
 
 
 
 
 
 
 
 
 
onAPIPointerChange(function):
 
Registers a callback when an api pointer is changed (can happen when the user clicks ok in settings, or when dbk_use*** is used. Does NOT happen when setAPIPointer is called)
 
 
 
 
 
 
 
 
 
setAPIPointer(functionid, address)
 
Sets the pointer of the given api to the given address. The address can be a predefined address set at initialization by Cheat Engine, or an address you got from an autoassembler script or injected dll (When Cheat Engine itself was targeted)
 
 
 
 
 
functionid:
 
  0: OpenProcess
 
    Known compatible address defines:
 
      windows_OpenProcess
 
      dbk_OpenProcess
 
     
 
  1: ReadProcessMemory
 
    Known compatible address defines:
 
      windows_ReadProcessMemory
 
      dbk_ReadProcessMemory
 
      dbk_ReadPhysicalMemory
 
      dbvm_ReadPhysicalMemory
 
 
 
 
 
  2: WriteProcessMemory
 
    Known compatible address defines:
 
      windows_WriteProcessMemory
 
      dbk_WriteProcessMemory
 
      dbk_WritePhysicalMemory
 
      dbvm_WritePhysicalMemory
 
 
 
 
 
  3: VirtualQueryEx
 
    Known compatible address defines:
 
      windows_VirtualQueryEx
 
      dbk_VirtualQueryEx
 
      VirtualQueryExPhysical
 
 
 
 
 
Extra lua variables defined:
 
dbk_NtOpenProcess : Address of the NtOpenProcess implementation in DBK32
 
 
 
 
 
 
 
 
 
The dbvm_ addresses should only be used with auto assembler scripts injected into Cheat Engine
 
dbvm_block_interrupts
 
Address of function dbvm_block_interrupts : DWORD; stdcall; 
 
 
 
 
 
dbvm_raise_privilege
 
Address of function dbvm_raise_privilege : DWORD; stdcall; 
 
 
 
 
 
dbvm_restore_interrupts
 
Address of function dbvm_restore_interrupts : DWORD; stdcall;
 
 
 
 
 
dbvm_changeselectors
 
Address of function dbvm_changeselectors(cs,ss,ds,es,fs,gs: dword): DWORD; stdcall;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Object Oriented Functions
 
 
 
 
 
class helper functions
 
inheritsFromObject(class)
 
Returns true if given any class
 
 
 
 
 
inheritsFromComponent(class)
 
Returns true if the given object inherits from the Component class
 
 
 
 
 
inheritsFromControl(class)
 
Returns true if the given object inherits from the Control class
 
 
 
 
 
inheritsFromWinControl(class)
 
Returns true if the given object inherits from the WinControl class
 
 
 
 
 
getFormCount()
 
Returns the total number of forms assigned to the main CE application
 
 
 
 
 
getForm(index)
 
Returns the form at the specific index
 
 
 
 
 
getMemoryViewForm() 
 
Returns the main memoryview form class object which can be accessed using the Form_ class methods and the methods of the classes it inherits from. There can be multiple memory views, but this will only find the original/base
 
 
 
 
 
getMainForm()
 
Returns the main form class object which can be accessed using the Form_ class methods and the methods of the classes it inherits from
 
 
 
 
 
getAddressList()
 
Returns the cheat table addresslist object
 
 
 
 
 
getFreezeTimer()
 
Returns the Timer object responsible for freezing values
 
 
 
 
 
getUpdateTimer()
 
Returns the Timer object responsible for updating the value list
 
 
 
 
 
 
 
 
 
Class definitions
 
 
 
 
 
Object class (Inheritance )
 
Most basic class. Basically all classes inherit from this class. Therefore, object_destroy will work on everything
 
 
 
 
 
object_getClassName(object)
 
Returns the classname of the given object
 
 
 
 
 
object_destroy(object)
 
Destroys the object (basically everything inherits from this class)
 
 
 
 
 
 
 
 
 
Component Class (Inheritance Object)
 
component_getComponentCount(Component) 
 
Returns the number of components attached to his component
 
 
 
 
 
component_getComponent(Component, index) 
 
Returns the specific component
 
 
 
 
 
component_findComponentByName(component, name) 
 
Returns the component with this name
 
 
 
 
 
component_getName(Component)
 
Return the name
 
 
 
 
 
component_setName(Component, newname) 
 
Changes the name
 
 
 
 
 
component_getTag(Component) 
 
Sets an integer value. You can use this for ID's or whatever storage you feel like
 
 
 
 
 
component_setTag(Component, tagvalue) 
 
Get the tag value
 
 
 
 
 
component_getOwner(Component)
 
Returns the owner of this component
 
 
 
 
 
 
 
 
 
 
 
 
 
Control Class (Inheritance Component->Object)
 
control_setCaption(control, caption) 
 
Sets the text on a control. All the gui objects fall in this category
 
 
 
 
 
control_getCaption(control) 
 
Returns the text of the control
 
 
 
 
 
control_setPosition(control, x,y)
 
Sets the x and y position of the object base don the top left position (relative to the client array of the owner object)
 
 
 
 
 
control_getPosition(contron) Returns the x and y position of the object (relative to the client array of the owner object)
 
 
 
 
 
control_setSize(control, width,height) 
 
Sets the width and height of the control
 
 
 
 
 
control_getSize(control) 
 
Sets the size of the control
 
 
 
 
 
control_setAlign(control, alignmentoption)
 
Sets the alignment of the control
 
 
 
 
 
control_getAlign(control, alignmentoption)
 
Gets the alignment of the control
 
 
 
 
 
control_getEnabled(control) 
 
Gets the enabled state of the control
 
 
 
 
 
control_setEnabled(control, boolean) 
 
Sets the enabled state of the control
 
 
 
 
 
control_getVisible(control)
 
Gets the visible state of the control
 
 
 
 
 
control_setVisible(control, boolean)
 
Sets the visible state of the control
 
 
 
 
 
control_getColor(control)
 
Gets the color
 
 
 
 
 
control_setColor(control, rgb)
 
Sets the color
 
 
 
 
 
control_getParent(control)
 
Returns nil or an object that inherits from the Wincontrol class
 
 
 
 
 
control_setParent(control)
 
Sets the parent for this control
 
 
 
 
 
control_getPopupMenu(control)
 
Gets the assigned popup menu to this control
 
 
 
 
 
control_setPopupMenu(control)
 
Sets the popup menu for this control
 
 
 
 
 
control_onClick(control, functionnameorstring)
 
Sets the onclick routine
 
  function (sender)
 
 
 
 
 
 
 
 
 
WinControl Class (Inheritance Control->Component->Object)
 
wincontrol_getControlCount(control) 
 
Returns the number of Controls attached to this class
 
 
 
 
 
wincontrol_getControl(control,index)
 
Returns a WinControl class object
 
 
 
 
 
wincontrol_canFocus(control)
 
Returns true if the object can be focused
 
 
 
 
 
wincontrol_focused(control)
 
Returns boolean true when focused
 
 
 
 
 
wincontrol_setFocus(control)
 
Tries to set keyboard focus the object
 
 
 
 
 
wincontrol_onEnter(control, function) 
 
Sets an onEnter event. (Triggered on focus enter)
 
  function (sender)
 
 
 
 
 
wincontrol_onExit(control, function) 
 
Sets an onExit event. (Triggered on lost focus)
 
  function (sender)
 
 
 
 
 
 
 
 
 
GenericHotkey Class  (Inheritance  Object)
 
The genericHotkey class lets you register hotkeys to Cheat Engine's internal hotkey handler
 
 
 
 
 
createHotkey(function, key, ...)
 
Returns an initialized GenericHotkey class object. Maximum of 5 keys
 
 
 
 
 
generichotkey_setKeys(hotkey, key, ....)
 
Changes the keys on a Hotkey class object
 
 
 
 
 
generichotkey_onHotkey(hotkey, function)
 
Changes the function called for a Hotkey class object
 
  function (sender)
 
 
 
 
 
 
 
 
 
 
 
 
 
MenuItem class(Inheritance Component->Object)
 
The menuItem class holds the manuitems of a Menu, PopupMenu or even another MenuItem
 
 
 
 
 
createMenuItem(ownermenu) 
 
Creates a menu item that gets added to the owner menu (See Menu class)
 
 
 
 
 
menuItem_getCaption(menuitem) 
 
Gets the caption of the menu item
 
 
 
 
 
menuItem_setCaption(menuitem, caption) 
 
Sets the caption of the menu item
 
 
 
 
 
menuItem_getShortcut(menuitem)
 
Returns the shortcut for this menu item
 
 
 
 
 
menuItem_setShortcut(menuitem, shortcut)
 
Sets the shortcut for this menuitem. A shortcut is a string in the form of ("ctrl+x")
 
 
 
 
 
menuItem_getCount(menuitem)
 
Returns the number of child menuitems it has
 
 
 
 
 
menuItem_getItem(menuitem, index)
 
Returns the menuitem object at the given index
 
 
 
 
 
menuItem_add(menuItem, menuItem) 
 
Adds a menuItem as a submenu item
 
 
 
 
 
menuItem_delete(menuitem, index)
 
 
 
 
 
menuItem_onClick(menuitem, function) 
 
Sets an onClick event
 
  function (sender)
 
 
 
 
 
 
 
 
 
Menu Class (Inheritance Component->Object)
 
The menu class object is the common Class ancestor for the MainMenu and PopupMenu classes
 
 
 
 
 
menu_getItems(menu) 
 
Returns the MenuItem of this Menu
 
 
 
 
 
 
 
 
 
MainMenu Class (Inheritance Menu->Component->Object)
 
The MainMenu class is the menu at the top of a form
 
 
 
 
 
createMainMenu(form)
 
The mainmenu is the menu at the top of a window
 
 
 
 
 
 
 
 
 
PopupMenu Class (Inheritance Menu->Component->Object)
 
The PopupMenu class is the menu that shows when rightclicking on an object
 
 
 
 
 
createPopupMenu(owner)
 
The popup menu is the menu that popus up when showing the (rightclick) context of an control
 
 
 
 
 
 
 
 
 
Strings Class (Inheritance  Object) (Mostly an abstract class)
 
The strings class is an abstract class that some text based classes make use of. Because it is abstract it can not be created directly, but only by the child classes that inherit from it
 
 
 
 
 
strings_clear(list) 
 
Deletes all strings in the list
 
 
 
 
 
strings_add(list, string) 
 
Adds a string to the list
 
 
 
 
 
strings_delete(list, index)
 
Deletes a string from the list
 
 
 
 
 
strings_getText(strings) 
 
Returns all the strings as one big string
 
 
 
 
 
strings_setText(strings) 
 
Sets the strings of the given strings object to the given text (can be multiline)
 
 
 
 
 
strings_indexOf(list, string)
 
Returns the index of the specified string. Returns -1 if not found
 
 
 
 
 
strings_insert(list, index, string)
 
Inserts a string at a specific spot moving the items after it
 
 
 
 
 
strings_getCount(list)
 
Returns the number is strings in the list
 
 
 
 
 
strings_remove(list, string)
 
Removes the given string from the list
 
 
 
 
 
strings_loadFromFile(list, filename)
 
Load the strings from a textfile
 
 
 
 
 
strings_saveToFile(list, filename) 
 
Save the strings to a textfile
 
 
 
 
 
strings_getString(list, index) 
 
Gets the string at the given index
 
 
 
 
 
strings_setString(list, index, string)
 
Replaces the string at the given index
 
 
 
 
 
 
 
 
 
Stringlist Class (Inheritance  Strings->Object)
 
Inherits from the Strings class and adds some properties that define on what to do when an item is added.
 
 
 
 
 
createStringlist() 
 
Creates a stringlist class object (for whatever reason, lua strings are probably easier to use)
 
 
 
 
 
stringlist_getDuplicates(list) 
 
Returns the duplicates property
 
 
 
 
 
stringlist_setDuplicates(list, Duplicates) 
 
Sets the duplicates property
 
  dupIgnore: Don't add duplicates
 
  dupAccept: Add duplicates
 
  dupError: Raise an exception when adding duplicates
 
 
 
 
 
stringlist_getSorted(list) 
 
Returns true if the list has the sorted property
 
 
 
 
 
stringlist_setSorted(list, boolean) 
 
Sets the sorted property
 
 
 
 
 
stringlist_getCaseSensitive(list) 
 
Returns true if the case sensitive property is set
 
 
 
 
 
stringlist_setCaseSensitive(list, boolean)
 
Sets the case sensitive property
 
 
 
 
 
 
 
 
 
 
 
 
 
Form Class (Inheritance ScrollingWinControl->CustomControl->WinControl->Control->Component->Object)
 
The Form class is a window
 
 
 
 
 
createForm(visible OPT)
 
Creates a Form class object(window) and returns the pointer for it. Visible is default true but can be changed
 
 
 
 
 
createFormFromFile(filename)
 
Creates a Form class object and initializes it based on the data in the given file.
 
It returns the generated form
 
 
 
 
 
form_saveToFile(form, filename)
 
Saves a userdefined form. (DOES NOT WORK ON NORMAL FORMS LIKE MAINFORM)
 
 
 
 
 
form_centerScreen(form)
 
Places the form at the center of the screen
 
 
 
 
 
form_hide(form) 
 
Hide the form
 
 
 
 
 
form_show(form) 
 
Show the form
 
 
 
 
 
form_showModal(form)
 
Show the form and wait for it to close and get the close result
 
 
 
 
 
form_isForegroundWindow(form)
 
eturns true if the specified form has focus
 
 
 
 
 
form_onClose(form, function) 
 
function (sender)  Return a CloseAction to determine how to close the window
 
 
 
 
 
form_getMenu(form) 
 
Returns the mainmenu object of this form
 
 
 
 
 
form_setMenu(form, mainmenu)
 
Sets a menu for the form
 
 
 
 
 
 
 
 
 
GraphicControl Class (Inheritance Control->Component->Object)
 
graphicControl_getCanvas(graphiccontrol) 
 
Returns the Canvas object for the given object that has inherited from customControl
 
 
 
 
 
 
 
 
 
Label Class (Inheritance GraphicControl->Control->Component->Object)
 
The Label class is a visual component that lets you display text
 
 
 
 
 
createLabel(owner)
 
Creates a Label class object which belongs to the given owner. Owner can be any object inherited from WinControl
 
 
 
 
 
 
 
 
 
Splitter Class (Inheritance CustomControl->WinControl->Control->Component->Object)
 
The Splitter class is a visual component that lets the user resize neighbouring components)
 
 
 
 
 
createSplitter(owner)
 
Creates a Splitter class object which belongs to the given owner. Owner can be any object inherited from WinControl
 
 
 
 
 
 
 
 
 
Panel Class (Inheritance CustomControl->WinControl->Control->Component->Object)
 
The Panel class is like a form which can contain visual components.
 
 
 
 
 
createPanel(owner)
 
Creates a Panel class object which belongs to the given owner. Owner can be any object inherited from WinControl
 
 
 
 
 
panel_getAlignment(panel)
 
Gets the alignment property
 
 
 
 
 
panel_setAlignment(panel, alignment)
 
Sets the alignment property
 
 
 
 
 
panel_getBevelInner(panel)
 
Gets the BevelInner property
 
 
 
 
 
panel_setBevelInner(panel, PanelBevel)
 
Sets the BevelInner property
 
 
 
 
 
panel_getBevelOuter(panel)
 
Gets the BevelOuter property
 
 
 
 
 
panel_setBevelOuter(panel, PanelBevel)
 
Sets the BevelOuter property
 
 
 
 
 
panel_getBevelWidth(panel)
 
Gets the BevelWidth property
 
 
 
 
 
panel_setBevelWidth(panel, BevelWidth)
 
Sets the BevelWidth property
 
 
 
 
 
panel_getFullRepaint(panel)
 
Gets the FullRepaint property
 
 
 
 
 
panel_setFullRepaint(panel, boolean)
 
Sets the FullRepaint property
 
 
 
 
 
 
 
 
 
 
 
 
 
Image Class (Inheritance GraphicControl->Control->Component->Object)
 
The Image class is a visual component that lets you show an image
 
 
 
 
 
createImage(owner) Creates an Image class object which belongs to the given owner. Owner can be any object inherited from WinControl
 
 
 
 
 
image_loadImageFromFile(image, filename)
 
Loads an image from the given filename
 
 
 
 
 
image_stretch(image, boolean)
 
Sets the stretch property. If true it will stretch the image to the dimension of the Image component
 
 
 
 
 
image_transparent(image, boolean)
 
Sets the transparency property.
 
 
 
 
 
image_getCanvas(image)
 
Gets the Canvas class object that belong to this image
 
 
 
 
 
image_getPicture(image) 
 
Returns the Picture object of this image (You can use this to load a stream)
 
 
 
 
 
 
 
 
 
Edit Class (Inheritance WinControl->Control->Component->Object)
 
The Edit class is a visual component that lets the user type in data (Use control_getCaption to get the user input)
 
 
 
 
 
createEdit(owner)
 
Creates an Edit class object which belongs to the given owner. Owner can be any object inherited from WinControl
 
 
 
 
 
edit_clear(edit)
 
Clears the edit field
 
 
 
 
 
edit_selectAll(edit)
 
Selects everything in the edit field
 
 
 
 
 
edit_clearSelection(edit)
 
Deleted the selected text in an editfield
 
 
 
 
 
edit_copyToClipboard(edit)
 
Copies the selected text in the edit field to the clipboard
 
 
 
 
 
edit_cutToClipboard(edit)
 
Copies the selected text in the edit field to the clipboard and then deletes it from the edit field
 
 
 
 
 
edit_pasteFromClipboard(edit)
 
Past the contents of the clipboard into the edit field
 
 
 
 
 
edit_onChange(edit, function)
 
Registers an onChange event
 
  function (sender)
 
 
 
 
 
 
 
 
 
Memo Class (Inheritance Edit->WinControl->Control->Component->Object)
 
The Memo class is a multiline edit field
 
 
 
 
 
createMemo(owner)
 
Creates a Memo class object which belongs to the given owner. Owner can be any object inherited from WinControl
 
 
 
 
 
memo_append(memo,string)
 
Adds a line to the end of the memo object
 
 
 
 
 
memo_getLines(memo) 
 
returns a class inherited from the Strings object. Adding and reading strings from this class will affect the memo
 
 
 
 
 
memo_getWordWrap(memo)
 
Gets the WordWrap property
 
 
 
 
 
memo_setWordWrap(memo, boolean)
 
Sets the WordWrap property
 
 
 
 
 
memo_getWantTabs(memo)
 
Gets the WantTabs property
 
 
 
 
 
memo_setWantTabs(memo, boolean)
 
Sets the WantTabs property
 
 
 
 
 
memo_getWantReturns(memo)
 
Gets the WantReturns property
 
 
 
 
 
memo_setWantReturns(memo, boolean)
 
Sets the WantReturns property
 
 
 
 
 
memo_getScrollbars(memo)
 
Gets the Scrollbard property
 
 
 
 
 
memo_setScrollbars(memo, scrollbarenumtype) 
 
Sets the scrollbars property. Horizontal only takes affect when wordwrap is disabled
 
valid enum types
 
    ssNone:  No scrollbars
 
    ssHorizontal: Has a horizontal scrollbar
 
    ssVertical: Has a vertical scrollbar
 
    ssBoth: Has both scrollbars
 
    ssAutoHorizontal: Same as above but only shows when there actually is something to scroll for
 
    ssAutoVertical: " " " " ...
 
    ssAutoBoth: " " " " ...
 
 
 
 
 
 
 
 
 
 
 
 
 
ButtonControl Class (Inheritance WinControl->Control->Component->Object)
 
Common ancestor of several button like objects.
 
 
 
 
 
 
 
 
 
Button Class (Inheritance ButtonControl->WinControl->Control->Component->Object)
 
The button class is a visual component in the shape of a button.
 
 
 
 
 
createButton(owner)
 
Creates a Button class object which belongs to the given owner. Owner can be any object inherited from WinControl
 
 
 
 
 
button_getModalResult(button)
 
Returns the ModalResult value of this button
 
 
 
 
 
button_setModalResult(button, mr)
 
Sets the ModalResult value of this button. ModalResult will close a Modal form and make it return the ModalResult. It has no effect on a normal form
 
 
 
 
 
 
 
 
 
CheckBox Class (Inheritance ButtonControl->WinControl->Control->Component->Object)
 
The Checkbox is a visual component that lets the user click it and change state between checked, unchecked, and if possible, grayed
 
 
 
 
 
createCheckBox(owner)
 
Creates a CheckBox class object which belongs to the given owner. Owner can be any object inherited from WinControl
 
 
 
 
 
checkbox_getAllowGrayed(CheckBox)
 
Gets the AllowGrayed property
 
 
 
 
 
checkbox_setAllowGrayed(CheckBox, boolean)
 
Sets the AllowGrayed property
 
 
 
 
 
checkbox_getState(checkbox)
 
Gets the current state of the checkbox
 
  0=Unchecked
 
  1=Checked
 
  2=Grayed
 
 
 
 
 
checkbox_setState(checkbox, state)
 
Sets the state of the checkbox
 
  0=Unchecked
 
  1=Checked
 
  2=Grayed
 
 
 
 
 
checkbox_onChange(checkbox, function)
 
Sets an OnChange event for the checkbox that gets triggered when the state has been changed (by the user of programatically)
 
  function (sender)
 
 
 
 
 
 
 
 
 
ToggleBox Class (Inheritance CheckBox->ButtonControl->WinControl->Control->Component->Object)
 
The togglebox is like a button, but can stay down. Use with the checkbox methods
 
 
 
 
 
createToggleBox(owner) Creates a ToggleBox class object which belongs to the given owner. Owner can be any object inherited from WinControl
 
 
 
 
 
 
 
 
 
GroupBox Class (Inheritance WinControl->Control->Component->Object)
 
The groupbox class is like a Panel, but then has a header on top
 
 
 
 
 
createGroupBox(owner) Creates a GroupBox class object which belongs to the given owner. Owner can be any object inherited from WinControl
 
 
 
 
 
 
 
 
 
RadioGroup Cass (Inheritance GroupBox->WinControl->Control->Component->Object)
 
The radiogroup is like a GroupBox but autopopulated using the Items(Strings object)
 
 
 
 
 
createRadioGroup(owner)
 
Creates a RadioGroup class object which belongs to the given owner. Owner can be any object inherited from WinControl
 
 
 
 
 
radiogroup_getRows(radiogroup)
 
Returns the number of rows
 
 
 
 
 
radiogroup_getItems(radiogroup)
 
Returns a Strings object
 
 
 
 
 
radiogroup_getColumns(radiogroup)
 
Returns the number of columns
 
 
 
 
 
radiogroup_setColumns(radiogroup, count)
 
Sets the number of columns
 
 
 
 
 
radiogroup_onClick(radiogroup, function)
 
Registers an OnClick event handler
 
  function (sender)
 
 
 
 
 
ListBox Class (Inheritance WinControl->Control->Component->Object)
 
The listbox class is a visual component with a list of selectable strings
 
 
 
 
 
createListBox(owner) Creates a ListBox class object which belongs to the given owner. Owner can be any object inherited from WinControl
 
 
 
 
 
listbox_clear(listbox)
 
Clears the whole listbox
 
 
 
 
 
listbox_getItems(listbox)
 
Returns a strings object you can use to add and remove strings
 
 
 
 
 
listbox_getItemIndex(listbox)
 
Returns the current selected stringnumber (counted from 0, -1 is no selection)
 
 
 
 
 
listbox_setItemIndex(listbox,index)
 
Sets the currently selected string (-1 is no selection)
 
 
 
 
 
listbox_getCanvas(listbox)
 
Returns the Canvas class object of this listbox
 
 
 
 
 
 
 
 
 
ComboBox Class (Inheritance WinControl->Control->Component->Object)
 
The Combobox is like a edit field with a listbox attached to it
 
 
 
 
 
createComboBox(owner) Creates a ComboBox class object which belongs to the given owner. Owner can be any object inherited from WinControl
 
 
 
 
 
combobox_clear(combobox)
 
Clears all entries in the combobox
 
 
 
 
 
combobox_getItems(combobox)
 
Return the Strings object used to control the list
 
 
 
 
 
combobox_getItemIndex(combobox)
 
Gets the currently selected object in the list
 
 
 
 
 
combobox_setItemIndex(combobox)
 
Sets the currently selected object in the list
 
 
 
 
 
combobox_getCanvas(combobox)
 
Returns the Canvas class object of this combobox
 
 
 
 
 
 
 
 
 
 
 
 
 
ProgressBar Class (Inheritance WinControl->Control->Component->Object)
 
The progressbar class is a visual representation for a bar that can show the current progress on something
 
 
 
 
 
createProgressBar(owner) Creates a ProgressBar class object which belongs to the given owner. Owner can be any object inherited from WinControl
 
 
 
 
 
progressbar_stepIt(progressbar)
 
 
 
 
 
progressbar_stepBy(progressbar, delta)
 
 
 
 
 
progressbar_getMax(progressbar)
 
 
 
 
 
progressbar_setMax(progressbar, integer)
 
 
 
 
 
progressbar_getMin(progressbar)
 
 
 
 
 
progressbar_setMin(progressbar, integer)
 
 
 
 
 
progressbar_getPosition(progressbar)
 
 
 
 
 
progressbar_setPosition(progressbar, integer)
 
 
 
 
 
 
 
 
 
 
 
 
 
TrackBar Class  (Inheritance WinControl->Control->Component->Object)
 
createTrackBar(owner) Creates a TrackBar class object which belongs to the given owner. Owner can be any object inherited from WinControl
 
 
 
 
 
trackbar_getMax(trackbar)
 
 
 
 
 
trackbar_setMax(trackbar, integer)
 
 
 
 
 
trackbar_getMin(trackbar)
 
trackbar_setMin(trackbar, integer)
 
 
 
 
 
trackbar_getPosition(progressbar)
 
 
 
 
 
trackbar_setPosition(progressbar, integer)
 
 
 
 
 
trackbar_onChange(trackbar, function)
 
  function (sender)
 
 
 
 
 
 
 
 
 
CollectionItem Class (Inheritance Object)
 
usually not used by lua users but just defining it here for future usage
 
 
 
 
 
 
 
 
 
 
 
 
 
ListColumn Class (Inheritance CollectionItem->Object)
 
The listcolumn class is an implemented CollectionItem class which is used by the ListColumns class of the listview class
 
 
 
 
 
listcolumn_setAutosize(listcolumns, boolean)
 
 
 
 
 
listcolumn_getCaption(listcolumns)
 
 
 
 
 
listcolumn_setCaption(listcolumns, caption)
 
 
 
 
 
listcolumn_getMaxWidth(listcolumns)
 
 
 
 
 
listcolumn_setMaxWidth(listcolumns, width)
 
 
 
 
 
listcolumn_getMinWidth(listcolumns)
 
 
 
 
 
listcolumn_setMinWidth(listcolumns, width)
 
 
 
 
 
listcolumn_getWidth(listcolumns)
 
 
 
 
 
listcolumn_setWidth(listcolumns, width)
 
 
 
 
 
 
 
 
 
 
 
 
 
Collection Class (Inheritance TObject)
 
The Collection class is an abstract class that the ListColumns class implements (And perhaps other classes as well)
 
 
 
 
 
collection_clear(collection)
 
 
 
 
 
collection_getCount(collection)
 
 
 
 
 
collection_delete(collection, index)
 
 
 
 
 
 
 
 
 
ListColumns class  (Inheritance Collection->Object)
 
The ListColumns class contains the Column class objects of a ListView object
 
 
 
 
 
listcolumns_add(listcolumns)
 
Returns a new ListColumn object
 
 
 
 
 
listcolumns_getColumn(listcolumns, index)
 
Returns a ListColum object;
 
 
 
 
 
 
 
 
 
ListItem Class  (Inheritance TObject)
 
The ListItem class object is an entry in a ListView. It contains the text for the first column and has a Strings object for the subitems
 
listitem_delete(listitem)
 
 
 
 
 
listitem_getCaption(listitem)
 
 
 
 
 
listitem_setCaption(listitem, string)
 
 
 
 
 
listitem_getSubItems(listitem)
 
Returns a Strings object
 
 
 
 
 
 
 
 
 
ListItems class  (Inheritance TObject)
 
The listItems class is a container for the ListItem class objects of a Listview
 
listitems_clear(listitems)
 
listitems_getCount(listitems)
 
listitems_add(listitems) Returns a new ListItem object
 
 
 
 
 
 
 
 
 
 
 
 
 
Listview Class  (Inheritance WinControl->Control->Component->Object)
 
The listview class lets you have a listbox like component with resizable columns. The items and columns inside a listview are special classes themself
 
 
 
 
 
createListView(owner)
 
Creates a ListView class object which belongs to the given owner. Owner can be any object inherited from WinControl
 
 
 
 
 
listview_clear(listview)
 
 
 
 
 
listview_getColumns(listview)
 
Returns a ListColumns object
 
 
 
 
 
listview_getItems(listview) 
 
Returns a ListItems object
 
 
 
 
 
listview_getItemIndex(listview)
 
 
 
 
 
listview_setItemIndex(listview, index)
 
 
 
 
 
listview_getCanvas(listview)
 
 
 
 
 
 
 
 
 
Timer Class  (Inheritance Component->object)
 
The timer class is an non visual component that when active triggers an onTimer event every few milliseconds, base don the given interval
 
 
 
 
 
createTimer(owner, enabled OPT)
 
Creates a timer object. If enabled is not given it will be enabled by default (will start as soon as an onTimer event has been assigned)
 
Owner may be nil, but you will be responsible for destroying it
 
 
 
 
 
timer_setInterval(timer, interval)
 
Sets the speed on how often the timer should trigger. In milliseconds (1000=1 second)
 
 
 
 
 
timer_getEnabled(timer)
 
Returns true if the timer is enabled
 
 
 
 
 
timer_setEnabled(timer, boolean)
 
Lets you enable of disable the timer
 
 
 
 
 
timer_onTimer(timer, function)
 
  function (sender)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
CustomControl class (CustomControl->WinControl->Control->Component->Object)
 
Class some other classes inherit from
 
 
 
 
 
customControl_getCanvas(customcontrol) 
 
Returns the Canvas object for the given object that has inherited from customControl
 
 
 
 
 
 
 
 
 
Canvas Class  (Inheritance CustomCanvas->Object)
 
The canvas class is a graphical class. It allows you do draw lines, pictures, and text on top of other object. Usually used in onPaint events and other graphical events
 
 
 
 
 
canvas_getBrush(canvas)
 
Returns the brush object of this canvas
 
 
 
 
 
canvas_getPen(canvas)
 
Returns the pen object of this canvas
 
 
 
 
 
canvas_getFont(canvas)
 
Returns the font object of this canvas
 
 
 
 
 
canvas_getWidth(canvas)
 
Returns the width of the canvas
 
 
 
 
 
canvas_getHeight(canvas)
 
Returns the height of the canvas
 
 
 
 
 
canvas_getPenPosition(canvas)
 
Returns the current x and y position of the Pen object in the canvas
 
 
 
 
 
canvas_setPenPosition(canvas, x,y)
 
Sets the x and y position of the Pen object in the canvas
 
 
 
 
 
canvas_line(canvas, sourcex, sourcey, destinationx, destinationy)
 
Draws a line on the canvas using the current Pen object's color from source to destination
 
 
 
 
 
canvas_lineTo(destinationx, destinationy)
 
Draws a line on the canvas using the current Pen's color and position
 
 
 
 
 
canvas_rect(x1,y1,x2,y2)
 
Draws a rectangle
 
 
 
 
 
canvas_fillRect(x1,y1,x2,y2)
 
Draws a filled rectangle
 
 
 
 
 
canvas_textOut(x,y, text)
 
Writes a piece of text at the given position
 
 
 
 
 
canvas_getTextWidth(canvas, text)
 
Returns the width of the text you give. Use it to figure out if the given string will fit
 
 
 
 
 
canvas_getTextHeight(canvas, text)
 
Returns the height of the text you give
 
 
 
 
 
canvas_getPixel(canvas, x,y)
 
Returns the RGB or 'Special' color at the current X, Y position
 
 
 
 
 
canvas_setPixel(canvas, x,y,color)
 
Lets you set the color of a specific pixel. (RGB or a 'special' color)
 
 
 
 
 
canvas_floodFill(canvas, x,y)
 
 
 
 
 
canvas_ellipse(canvas, x1,y1,x2,y2)
 
 
 
 
 
canvas_gradientFill(canvas, x1,y1,x2,y2, startcolor, stopcolor, direction) 
 
Gradient fills a rectangle. Direction can be 0 or 1. 0=Vertical 1=Horizontal
 
 
 
 
 
canvas_copyRect(dest_canvas, dest_x1,dest_y1,dest_x2,dest_y2, sourceCanvas, source_x1,source_y1,source_x2,source_y2)
 
 
 
 
 
canvas_draw(canvas, x,y, graphic) 
 
Draw the image of a specific Graphic class
 
 
 
 
 
 
 
 
 
Pen Class  (Inheritance CustomPen->CanvasHelper->Object)
 
The Pen class is part of the Canvas object. It's used to draw lines
 
 
 
 
 
pen_getColor(pen)
 
pen_setColor(pen, color)
 
pen_getWidth(pen)
 
pen_setWidth(pen, width)
 
 
 
 
 
 
 
 
 
Brush Class  (Inheritance CustomBrush->CanvasHelper->Object)
 
The brush class is part of the Canvas object. It's used to fill surfaces
 
brush_getColor(pen)
 
brush_setColor(pen,color)
 
 
 
 
 
Font Class  (Inheritance CustomFont->CanvasHelper->Object)
 
font_getName(font)
 
font_setName(font, fontname)
 
font_getSize(font)
 
font_setSize(font, size)
 
 
 
 
 
 
 
 
 
Graphic Class  (Inheritance Object) 
 
Abstract class (Nothing to concern yourself with, just showing that this class exists)
 
 
 
 
 
Picture Class  (Inheritance Object) 
 
Container for the Graphic class
 
 
 
 
 
createPicture()
 
 
 
 
 
picture_loadFromFile(picture, filename)
 
 
 
 
 
picture_loadFromStream(stream, originalextension OPTIONAL)
 
 
 
 
 
picture_assign(picture, sourcepicture)
 
 
 
 
 
picture_getGraphic(picture)
 
Gets the Graphic object of this picture
 
 
 
 
 
 
 
 
 
OpenDialog Class (Inheritance FileDialog->CommonDialog->Component->Object)
 
The OpenDialog class is used to let the user select a file to open
 
 
 
 
 
opendialog_execute(openDialog)
 
Shows the Open dialog and returns the string to the selected file
 
 
 
 
 
SaveDialog Class (Inheritance OpenDialog->FileDialog->CommonDialog->Component->Object)
 
The SaveDialog class is a copy of the OpenDialog class but is used to select a file for saving
 
 
 
 
 
 
MemoryStream Class (Inheritance Stream->Object)
 
The memorystream class is a Stream class that is stored completely in memory. Because it's a stream there are multiple functions that can work with it
 
 
 
 
 
FileStream Class (Inheritance HandleStream->Stream->Object)
 
The FileStream class is a Stream class that is linked to an open file on disk
 
 
 
 
 
 
 
 
 
TableFile Class (Inheritance Object)
 
Tablefiles are files stored into a Cheat Table. You can access the data of such a file using this class
 
 
 
 
 
findTableFile(filename)
 
Returns the TableFile class object for the saved file
 
 
 
 
 
tablefile_saveToFile(tablefile, filename)
 
tablefile_getData(tablefile, filename) 
 
Gets a MemoryStream object of this TableFile
 
 
 
 
 
 
 
 
 
CheatComponent Class (Inheritance WinControl->Control->Component->Object)
 
The cheatcomponent class is the component used in Cheat Engine 5.x trainers
 
Most people will probably want to design their own components but for those that don't know much coding and use the autogenerated trainer this will be used
 
 
 
 
 
cheatcomponent_setActive(cheatcomponent, boolean, deactivatetime OPTIONAL) 
 
sets the cheat object's Active color to enabled or disabled. The deactivatetime parameter turns the active color off automatically after the given time in milliseconds (e.g one hit cheats like increase by)
 
 
 
 
 
cheatcomponent_getActive(cheatcomponent)
 
 
 
 
 
cheatcomponent_setDescription(cheatcomponent, string)
 
 
 
 
 
cheatcomponent_getDescription(cheatcomponent)
 
 
 
 
 
cheatcomponent_setHotkey(cheatcomponent, string)
 
 
 
 
 
cheatcomponent_getHotkey(cheatcomponent)
 
 
 
 
 
cheatcomponent_setDescriptionLeft(cheatcomponent, integer)
 
 
 
 
 
cheatcomponent_getDescriptionLeft(cheatcomponent)
 
 
 
 
 
cheatcomponent_setHotkeyLeft(cheatcomponent, integer)
 
 
 
 
 
cheatcomponent_getHotkeyLeft(cheatcomponent)
 
 
 
 
 
cheatcomponent_getEditValue(cheatcomponent) 
 
Returns the text from the editbox of this component
 
 
 
 
 
cheatcomponent_setEditValue(cheatcomponent, value)
 
Sets the text on an editbox
 
 
 
 
 
 
 
 
 
MemoryRecordHotkey Class (Inheritance object)
 
The memoryRecordHotkey class object is part of a MemoryRecord class. It's used as an interface to each individual hotkey inside a Cheat Table
 
 
 
 
 
memoryrecordhotkey_getDescription(hotkey)
 
 
 
 
 
memoryrecordhotkey_getHotkeyString(hotkey)
 
 
 
 
 
memoryrecordhotkey_getID(hotkey)
 
Returns the unique ID of this hotkey (Each hotkey inside a cheat entry has an unique id)
 
 
 
 
 
memoryrecordhotkey_getOwner(hotkey)
 
Returns the MemoryRecord this hotkey belongs to
 
 
 
 
 
memoryrecordhotkey_doHotkey(hotkey)
 
Executes the hotkey as if it got triggered by the keyboard
 
 
 
 
 
memoryrecordhotkey_onHotkey(hotkey, hotkeyfunction)
 
Registers a function to be called when the hotkey is pressed
 
  function (memoryrecordhotkey)
 
 
 
 
 
memoryrecordhotkey_onPostHotkey(hotkey, hotkeyfunction)
 
Registers a function to be called after the hotkey has been dealt with
 
  function (hotkey)
 
 
 
 
 
 
 
 
 
 
 
 
 
MemoryRecord Class
 
The Memoryrecord class object describes a Cheat Table's Cheat Entry.
 
 
 
 
 
memoryrecord_getID(memoryrecord)
 
Returns the unique id of this memory record. Every memory record has an unique id
 
 
 
 
 
memoryrecord_getHotkeyCount(memoryrecord)
 
Returns the number of hotkeys assigned to this Cheat Entry
 
 
 
 
 
memoryrecord_getHotkey(memoryrecord, index)
 
Returns a memoryrecordhotkey class
 
 
 
 
 
memoryrecord_getHotkeyByID(memoryrecord, ID)
 
Every hotkey in a memoryrecord gets an unique ID. This way you can always find the hotkey even if the order of hotkeys has changed (or deleted)
 
 
 
 
 
memoryrecord_setDescription(memoryrecord, description)
 
Sets the specified description for this entry
 
 
 
 
 
memoryrecord_getDescription(memoryrecord)
 
Gets the current description of this entry
 
 
 
 
 
memoryrecord_getAddress(memoryrecord)
 
Returns the address and optional offsets for a pointer (note that in 64-bit kernelmode addresses will be rounded down...)
 
 
 
 
 
memoryrecord_setAddress(memoryrecord,address,offsets OPTIONAL) 
 
Sets the address of a entry. You can give as many offsets as you need
 
 
 
 
 
memoryrecord_getType(memoryrecord) 
 
Returns the Variable type. (vtByte to vtCustom)
 
 
 
 
 
memoryrecord_setType(memoryrecord, vartype) 
 
Sets the type of the entry
 
 
 
 
 
memoryrecord_getValue(memoryrecord)
 
Returns the current value of the cheat table entry as a string
 
 
 
 
 
memoryrecord_setValue(memoryrecord, value)
 
Sets the value of a cheat table entry
 
 
 
 
 
memoryrecord_getScript(memoryrecord) 
 
If the entry is of type vtAutoAssembler then you can get the script with this routine
 
 
 
 
 
memoryrecord_setScript(memoryrecord, script)
 
 
 
 
 
memoryrecord_isActive(memoryrecord)
 
 
 
 
 
memoryrecord_freeze(memoryrecord, updownfreeze OPTIONAL)
 
Sets the entry to frozen state. updownfreeze is optional. 0=freeze, 1=allow increase, 2=allow decrease
 
 
 
 
 
memoryrecord_unfreeze(memoryrecord)
 
Unfreezes an entry
 
 
 
 
 
memoryrecord_setColor(memoryrecord, colorrgb)
 
Sets the color of the entry
 
 
 
 
 
memoryrecord_appendToEntry(memoryrecord,memoryrecord) 
 
Adds the entry to another entry
 
 
 
 
 
memoryrecord_delete(memoryrecord)
 
It's unknown what this function does, all that is known is that after using this command other memrec routines with this table entry value don't work anymore...
 
 
 
 
 
memoryrecord_onActivate(memoryrecord, function)
 
Registers a function to be called when a cheat entry is Activated
 
  function (memoryrecord, before, currentstate) boolean
 
  If before is true returning false will cause the activation to stop
 
 
 
 
 
memoryrecord_onDeactivate(memoryrecord, function)
 
Registers a function to be called when a cheat entry is Deactivated
 
  function (memoryrecord, before, currentstate) boolean
 
  If before is true returning false will cause the deactivation to stop
 
 
 
 
 
memoryrecord_onDestroy(memoryrecord, function)
 
Registers a function to be called when a cheat entry is delete
 
  function (memoryrecord)
 
 
 
 
 
 
 
 
 
Addresslist Class
 
The addresslist class is a container for memory records
 
 
 
 
 
addresslist_getCount(addresslist)
 
 
 
 
 
addresslist_getMemoryRecord(addresslist, index)
 
 
 
 
 
addresslist_getMemoryRecordByDescription(addresslist, description)
 
 
 
 
 
addresslist_getMemoryRecordByID(addresslist, ID)
 
 
 
 
 
addresslist_createMemoryRecord(addresslist) 
 
creates a generic cheat table entry and adds it to the list. Returns a tableentry pointer you can use with memoryrecord routines
 
 
 
 
 
 
 
 
 
 
 
 
 
Memoryview Cass (Inheritance Form->ScrollingWinControl->CustomControl->WinControl->Control->Component->Object)
 
The memoryview class is the Memory view window of Cheat Engine. Use this as a basis to access the objects inside this window
 
 
 
 
 
memoryview_getDisassemblerView(memoryView)
 
Returns the visual disassembler object on the memoryview window
 
 
 
 
 
memoryview_getHexadecimalView(memoryView)
 
Returns the visual hexadecimal object on the memoryview window
 
 
 
 
 
 
 
 
 
Disassemblerview class (Inheritance Panel->CustomControl->WinControl->Control->Component->Object)
 
The visual disassembler used in the memory view window
 
 
 
 
 
disassemblerview_getSelectedAddress(disassemblerview)
 
 
 
 
 
disassemblerview_setSelectedAddress(disassemblerview, address)
 
 
 
 
 
disassemblerview_onSelectionChange(disassemblerview, function)
 
Registers a function to be called when the selection changes
 
  function(disassemblerview, address, address2)
 
 
 
 
 
Hexadecimal class (Inheritance Panel->CustomControl->WinControl->Control->Component->Object)
 
The visual hexadecimal object used on the memory view window
 
 
 
 
 
hexadecimalview_getTopAddress(hexadecimalview)
 
 
 
 
 
hexadecimalview_setTopAddress(hexadecimalview, address)
 
 
 
 
 
hexadecimalview_onAddressChange(hexadecimalview, function)
 
Registers a function to be called when the address is changed
 
  function(hexadecimalview, address)
 
 
 
 
 
hexadecimalview_onByteSelect(hexadecimalview, function)
 
Registers a function to be called when the selection changes
 
  function(hexadecimalview, address, address2)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Memory Scanning classes and routines
 
 
 
 
 
AOBScan(x,x,x,x,...)
 
Scans the currently opened process and returns a StringList object containing all the results. Don't forget to free this list when done else you will create a memory leak.
 
 
 
 
 
Bytevalue of higher than 255 or anything not an integer will be seen as a wildcard
 
 
 
 
 
 
 
 
 
AOBScan("aobstring", protectionflags OPTIONAL, alignmenttype OPTIONAL, alignmentparam HALFOPTIONAL)
 
protectionflags is a string.
 
  X=Executable W=Writable memory C=Copy On Write. Add a + to indicate that flag MUST be set and a - to indicate that that flag MUST NOT be set. (* sets it to don't care)
 
  Examples
 
    +W-C = Writable memory exluding copy on write and doesn't care about the Executable flag
 
    +X-C-W = Find readonly executable memory
 
    +W = Finds all writable memory and don't care about copy on write or execute
 
    "" = Find everything (is the same as "*X*C*W" )
 
 
 
 
 
 
 
 
 
alignmenttype is an integer
 
  0=No alignment check
 
  1=Address must be dividable by alignmentparam
 
  2=Address must end with alignmentparam
 
alignmentparam is a string which either holds the value the addresses must be dividable by or what the last digits of the address must be
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
MemScan Class (Inheritance Object)
 
The memscan class is the memory scanner of Cheat engine
 
 
 
 
 
createMemScan(progressbar OPTIONAL) 
 
Returns a new MemScan class object
 
 
 
 
 
getCurrentMemscan() 
 
Returns the current memory scan object. If tabs are used the current tab's memscan object
 
 
 
 
 
memscan_firstScan(memscan, scanoption, vartype, roundingtype, input1, input2 ,startAddress ,stopAddress ,protectionflags ,alignmenttype ,"alignmentparam" ,isHexadecimalInput ,isNotABinaryString, isunicodescan, iscasesensitive);
 
  Does an initial scan.
 
  memscan The MemScan object created with createMemScan
 
  scanOption : Defines what type of scan is done. Valid values for firstscan are
 
    soUnknownValue= Unknown initial value scan
 
    soExactValue= Exact Value scan
 
    soValueBetween= Value between scan
 
    soBiggerThan= Bigger than ... scan
 
    soSmallerThan= smaller than ... scan
 
 
 
 
 
  vartype Defines the variable type. Valid variable types are
 
    vtByte
 
    vtWord  (2 bytes)
 
    vtDword (4 bytes)
 
    vtQword (8 bytes)
 
    vtSingle (float)
 
    vtDouble
 
    vtString
 
    vtByteArray
 
    vtBinary
 
    vtAll
 
 
 
 
 
  roundingtype: Defines the way scans for exact value floating points are handled
 
    rtRounded:  Normal rounded scans. If exact value = "3" then it includes 3.0 to 3.49999999. If exact value is "3.0" it includes 3.00 to 3.0499999999
 
    rtTruncated: Truncated algoritm. If exact value = "3" then it includes 3.0 to 3.99999999. If exact value is "3.0" it includes 3.00 to 3.099999999
 
    rtExtremerounded: Rounded Extreme. If exact value = "3" then it includes 2.0000001 to 3.99999999. If exact value is "3.0" it includes 2.900000001 to 3.099999999
 
 
 
 
 
  input1: If required by the scanoption this is a string of the given variable type
 
  input2: If requires by the scanoption this is the secondary input
 
 
 
 
 
  startAddress:  The start address to scan from. You want to set this to 0
 
  stopAddress:  The address the scan should stop at. (You want to set this to 0xffffffffffffffff)
 
 
 
 
 
  protectionflags:  See aobscan about protectionflags
 
  alignmenttype:  Scan alignment type. Valid options are
 
    fsmNotAligned=  No alignment check
 
    fsmAligned    =The address must be dividable by the value in alignmentparam
 
    fsmLastDigits =  The last digits of the address must end with the digits provided by alignmentparam
 
 
 
 
 
  alignmentparam:  String that holds the alignment parameter.
 
 
  isHexadecimalInput: When true this will handle the input field as a hexadecimal string else decimal
 
  isNotABinaryString: When true and the varType is vtBinary this will handle the input field as a decimal instead of a binary string
 
  isunicodescan: When true and the vartype is vtString this will do a unicode (utf16) string scan else normal utf8 string
 
  iscasesensitive:  When true and the vartype is vtString this check if the case matches
 
 
 
 
 
   
 
 
 
 
 
 
 
 
 
memscan_nextScan(memscan, scanoption, roundingtype, input1,input2, isHexadecimalInput, isNotABinaryString, isunicodescan, iscasesensitive, ispercentagescan, savedresultname OPTIONAL);
 
Does a next scan based on the current addresslist and values of the previous scan or values of a saved scan
 
  memscan: The MemScan object that has previously done a first scan
 
  scanoption
 
    soExactValue= Exact Value scan
 
    soValueBetween= Value between scan
 
    soBiggerThan= Bigger than ... scan
 
    soSmallerThan= smaller than ... scan
 
    soIncreasedValue= Increased value scan
 
    soIncreasedValueBy= Increased value by scan
 
    soDecreasedValue= Decreased value scan
 
    soDecreasedValueBy= Decreased value by scan
 
    soChanged= Changed value scan
 
    soUnchanged =Unchanged value scan
 
 
 
  roundingtype: Defined the way scans for exact value floating points are handled
 
    rtRounded = Normal rounded scans. If exact value = "3" then it includes 3.0 to 3.49999999. If exact value is "3.0" it includes 3.00 to 3.0499999999
 
    rtTruncated =Truncated algoritm. If exact value = "3" then it includes 3.0 to 3.99999999. If exact value is "3.0" it includes 3.00 to 3.099999999
 
    rtExtremerounded= Rounded Extreme. If exact value = "3" then it includes 2.0000001 to 3.99999999. If exact value is "3.0" it includes 2.900000001 to 3.099999999
 
 
 
  input1: If required by the scanoption this is a string of the given variable type
 
  input2: If requires by the scanoption this is the secondary input
 
 
 
 
 
  isHexadecimalInput :When true this will handle the input field as a hexadecimal string else decimal
 
  isNotABinaryString: When true and the varType is vtBinary this will handle the input field as a decimal instead of a binary string
 
  isunicodescan: When true and the vartype is vtString this will do a unicode (utf16) string scan else normal utf8 string
 
  iscasesensitive:  When true and the vartype is vtString this check if the case matches
 
  ispercentage: When true and the scanoption is of type soValueBetween, soIncreasedValueBy or soDecreasedValueBy: will cause CE to do a precentage scan instead of a normal value scan
 
  savedResultName: String that holds the name of a saved result list that should be compared against. First scan is called "FIRST"
 
 
 
 
 
 
 
 
 
memscan_newscan(memscan) 
 
Clears the current results
 
 
 
 
 
memscan_waitTillDone(memscan)
 
 
 
 
 
memscan_saveCurrentResults(memscan, name)
 
 
 
 
 
memscan_getAttachedFoundlist(memscan) 
 
Returns a FoundList object if one is attached to this scanresults. Returns nil otherwise
 
 
 
 
 
FoundList
 
The foundlist is an object that opens the current memscan's result file and provides an interface for reading out the addresses
 
 
 
 
 
createFoundList(memscan)
 
foundlist_initialize(foundlist)
 
foundlist_deinitialize(foundlist)
 
foundlist_getCount(foundlist)
 
foundlist_getAddress(foundlist, index) 
 
Returns the address as a string
 
 
 
 
 
foundlist_getValue(foundlist, index)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Undefined Property Functions
 
 
Not all properties of all classes have been explicitly exposed to lua, but if you know the name of a property of a specific class you can still access them (assuming they are declared as published in the pascal class declaration)
 
Not all properties of all classes have been explicitly exposed to lua, but if you know the name of a property of a specific class you can still access them (assuming they are declared as published in the pascal class declaration)
getPropertyList(class) 
 
Returns a StringList object containing all the published properties of the specified class (free the list when done) (Note, not all classed with properties have 'published' properties. E.g StringList itself)
 
 
  
setProperty(class, propertyname, propertyvalue)  Sets the value of a published property of a class (Won't work for method properties)
+
* [[Lua:getPropertyList|getPropertyList]]: Returns a [[Lua:Class:StringList|StringList]] object containing all the published properties of the specified class
getProperty(class, propertyname)  Gets the value of a published property of a class (Won't work for method properties)
+
* [[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

Latest revision as of 13:51, 30 September 2023

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


Variables[edit]

Globals[edit]

  • TrainerOrigin: A variable that contains the path of the trainer that launched cheat engine (Only set when launched as a trainer)
  • process: A variable that contains the main modulename of the currently opened process
  • MainForm: The main Cheat Engine gui
  • AddressList: The address list of the main Cheat Engine gui

Variables[edit]

  • 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[edit]

Cheat table[edit]

These functions help manage the cheat table.

Trainers[edit]


Protection[edit]

  • activateProtection: Prevents basic memory scanners from opening the cheat engine process
  • enableDRM: Prevents normal memory scanners from reading the Cheat Engine process (kernelmode)
  • encodeFunction: Converts a given function into an encoded string that you can pass on to decodeFunction
  • decodeFunction: Converts an encoded string back into a function


Scanning[edit]

These functions control Cheat Engine's scanning.


Process[edit]


Threads[edit]

  • getCPUCount: Returns the number of CPU's
  • getThreadlist: Fills a List object with the threadlist of the currently opened process
  • inMainThread: Returns true if the current code is running inside the main thread (6.4+)
  • synchronize: Calls the given function from the main thread. Returns the return value of the given function
  • queue: Calls the given function from the main thread. Does not wait for the result
  • checkSynchronize: Call this from an infinite loop in the main thread when using threading and synchronize calls


Handles[edit]

  • getHandleList: Returns a table with all the handles in the system


Addresses[edit]

These functions help convert between memory addresses and symbols/CEAddressStrings.


Memory[edit]

These functions read/write memory from the opened process.

Reading[edit]

  • readBytes: Returns the bytes at the given address. If ReturnAsTable is true it will return a table instead of multiple bytes
  • readSmallInteger: Reads a 16-bit integer from the specified address.
  • readInteger: Reads a 32-bit integer from the specified address.
  • readQword: Reads a 64-bit integer from the specified address.
  • readPointer: In a 64-bit target this equals readQword, in a 32-bit target readInteger().
  • readFloat: Reads a single precision floating point value from the specified address
  • readDouble: Reads a double precision floating point value from the specified address
  • readString: Reads a string from memory until it hits a 0-terminator. maxlength is just so you won't freeze for too long
  • readRegionFromFile: Writes the given file to a specific address


Writing[edit]

  • writeBytes: Write the given bytes to the given address from a table
  • 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: Write a 64-bit integer to the specified address. Returns true on success.
  • writeFloat: Writes a single precision floating point to the specified address. Returns true on success.
  • writeDouble: Writes a double precision floating point to the specified address. Returns true on success.
  • writeString: Write a string to the specified address. Returns true on success.
  • writeRegionToFile: Writes the given region to a file. Returns the number of bytes written.
  • writeSmallIntegerLocal: Writes a 16-bit integer to the specified address in CE's memory. Returns true on success
  • writeIntegerLocal: Writes a 32-bit integer to the specified address in CE's memory. Returns true on success
  • writeQwordLocal: Writes a 64-bit integer to the specified address in CE's memory. Returns true on success
  • writeFloatLocal: Writes a single precision floating point to the specified address in CE's memory. Returns true on success
  • writeDoubleLocal: Writes a double precision floating point to the specified address in CE's memory. Returns true on success
  • writeStringLocal: Write a string to the specified address. Returns true on success.
  • writeBytesLocal: See writeBytes but then it's for Cheat Engine's memory

Conversions[edit]

To Byte Table[edit]

From Byte Table[edit]


Binary[edit]

Input devices[edit]

These functions get/set keyboard/mouse input.

Game Controller[edit]

Clipboard[edit]


Screen[edit]

Sounds[edit]

xmplayer[edit]

Text to Speech[edit]


Fonts[edit]


Forms and Windows[edit]


Cheat Engine[edit]

These functions help manage Cheat Engine itself.

Forms[edit]

Messages[edit]

Input[edit]

  • inputQuery: Shows a dialog where the user can input a string. This function returns the given string, or nil on cancel (CE6.4+)

Shortcuts[edit]

  • shortCutToText: Returns the textual representation of the given shortcut value (integer) (6.4+)
  • textToShortCut: Returns an shortcut integer that the given string represents. (6.4+)
  • convertKeyComboToString: Returns a string representation of the given keys like the hot-key handler does

Speed Hack[edit]


Lua[edit]

These functions help manage Lua itself.

  • resetLuaState: This will create a new Lua state that will be used.
  • sleep: Pauses for the number of specified milliseconds
  • createRef: Integer - Returns an integer reference that you can use with getRef
  • getRef: Returns whatever the reference points out
  • destroyRef: Removes the reference


Types[edit]

These functions help structure a process's memory into datatypes.


Object-oriented[edit]

These functions determine how a Lua object fits in the class hierarchy.


Assembly[edit]

These functions help work with the x86 machine code as assembly.

  • autoAssemble: Runs the auto assembler with the given text
  • autoAssembleCheck: Checks the script for syntax errors. Returns true on succes, false with an error message on failure
  • disassemble: Disassembles the given address and returns a string in the format of "address - bytes - opcode extra"
  • splitDisassembledString: Returns 4 strings. The address, bytes, opcode and extra field
  • getInstructionSize: Returns the size of an instruction
  • getPreviousOpcode: Returns the address of the previous opcode (guess)
  • registerAssembler: Registers a function to be called when the single line assembler is invoked to convert an instruction to a list of bytes
  • unregisterAssembler: Unregisters the registered assembler


Auto Assembler[edit]


Scripts[edit]


Debugger[edit]

These functions manage the debugger. See Lua Debugging.


DBK[edit]


DBVM[edit]

Translation[edit]

  • getTranslationFolder: Returns the path of the current translation files, empty if there is no translation going on
  • loadPOFile: Loads a ".PO" file used for translation
  • translate: Returns a translation of the string, returns the same string if it can't be found
  • translateID: Returns a translation of the string ID


Files[edit]

  • getFileVersion: Returns the 64-bit file version, and a table that has split up the file version into major, minor, release and build
  • getFileList: Returns an indexed table with filenames
  • getDirectoryList: Returns an indexed table with directory names


Structures[edit]


Miscellaneous[edit]

Classes[edit]

Besides the above functions, Cheat Engine also implements some classes.

  • Addresslist: The addresslist class is a container for memory records
  • Bitmap: Bitmap based Graphic object
  • Brush: The brush class is part of the Canvas object. It's used to fill surfaces
  • Button: The button class is a visual component in the shape of a button.
  • ButtonControl: Common ancestor of several button like objects.
  • 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
  • Calendar:
  • CEForm:
  • CheatComponent: The cheatcomponent class is the component used in Cheat Engine 5.x trainers
  • CheckBox: The Checkbox is a visual component that lets the user click it and change state between checked, unchecked, and if possible, grayed
  • Component : Base class for all components that need owner-owned functionality.
  • Control : Base class for visible controls.
  • Collection: The Collection class is an abstract class that the ListColumns class implements (And perhaps other classes as well)
  • CollectionItem: Basic object that is managed by a Collection class
  • ComboBox: The Combobox is like an edit field with a ListBox attached to it
  • CriticalSection:
  • CustomControl: Base class for windowed controls which paint themselves
  • CustomType: The custom type is an convertor of raw data, to a human readable interpretation.
  • 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
  • D3DHook_FontMap: A fontmap is a texture that contains extra data regarding the characters
  • D3DHook_Texture: This class controls the texture in memory. Without a sprite to use it, it won't show
  • D3Dhook_TextContainer: A d3dhook_sprite class draws a piece of text on the screen based on the used fontmap
  • D3DHook_RenderObject: The renderobject is the abstract class used to control in what manner objects are rendered.
  • D3DHook_Sprite: A d3dhook_sprite class is a visible texture on the screen
  • Disassembler:
  • Disassemblerview: The visual disassembler used in the memory view window
  • DisassemblerviewLine:
  • DissectCode:
  • Edit: The Edit class is a visual component that lets the user type in data (Use control_getCaption to get the user input)
  • Event:
  • FileStream: The FileStream class is a Stream class that is linked to an open file on disk
  • FileDialog:
  • FindDialog:
  • Font: Class that defines a font
  • Form: Class that defines a window
  • 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
  • GenericHotkey: Lets you register hotkeys to Cheat Engine's internal hotkey handler
  • Graphic: Base class for dealing with Graphic images (Abstract)
  • GraphicControl: Class that supports simple lightweight controls that do not need the ability to accept keyboard input or contain other controls.
  • GroupBox: The groupbox class is like a Panel, but then has a header on top
  • Hexadecimal: The visual hexadecimal object used on the memory view window
  • Hexadecimalview: The visual hexadecimal object used on the memory view window
  • Icon:
  • Image: The Image class is a visual component that lets you show an image
  • Internet:
  • JpegImage:
  • Label: The Label class is a visual component that lets you display text
  • LuaPipe: Abstract class that LuaPipeServer and LuaPipeclient inherit from
  • LuaPipeClient: Class implementing a client that connects to a pipe
  • LuaPipeServer: Class launching the server side of a pipe
  • ListBox: The listbox class is a visual component with a list of selectable strings
  • ListColumn: The listcolumn class is an implemented CollectionItem class which is used by the ListColumns class of the listview class
  • ListColumns: The ListColumns class contains the Column class objects of a ListView object
  • ListItem: The ListItem class object is an entry in a ListView
  • ListItems: The listItems class is a container for the ListItem class objects of a Listview
  • Listview: The listview class lets you have a listbox like component with resizable columns
  • MainMenu: The menu at the top of a form
  • Memo: The Memo class is a multiline edit field
  • MemScan: The memscan class is the memory scanner of Cheat engine
  • Menu: Common Class ancestor for the MainMenu and PopupMenu classes
  • MenuItem: Holds the menuitems of a Menu, PopupMenu or even another MenuItem
  • MemoryRecord: The Memoryrecord class object describes a Cheat Table's Cheat Entry.
  • MemoryRecordHotkey: The memoryRecordHotkey class object is part of a MemoryRecord class. It's used as an interface to each individual hotkey inside a Cheat Table
  • MemoryStream: The memorystream class is a Stream class that is stored completely in memory. Because it's a stream there are multiple functions that can work with it
  • Memoryview: The memoryview class is the Memory view window of Cheat Engine. Use this as a basis to access the objects inside this window
  • MultiReadExclusiveWriteSynchronizer:
  • Object: Most basic class. All classes inherit from this class
  • PaintBox:
  • PageControl: This is an object that can hold multiple pages
  • Panel: The Panel class is like a form which can contain visual components.
  • Pen: The Pen class is part of the Canvas object. It's used to draw lines
  • Picture: Container for the Graphic class
  • PopupMenu: The menu that shows when rightclicking on an object
  • PortableNetworkGraphic:
  • ProgressBar: The progressbar class is a visual representation for a bar that can show the current progress on something
  • RadioGroup: The radiogroup is like a GroupBox but autopopulated using the Items(Strings object)
  • RasterImage: Base class for some graphical controls
  • RIPRelativeScanner:
  • OpenDialog: The OpenDialog class is used for selecting files to open.
  • SaveDialog: The SaveDialog class is based on the OpenDialog class but is used to select a file for saving
  • SelectDirectoryDialog:
  • Semaphore:
  • Settings: This class can be used to read out and set settings of cheat engine and of plugins, and store your own data
  • Splitter: The Splitter class is a visual component that lets the user re-size neighboring components)
  • Stringlist: Class that holds a list of strings
  • Strings: Abstract class that some text based classes make use of
  • StringStream:
  • Structure:
  • StructureElement:
  • StructureFrm:
  • structGroup:
  • SymbolList: This class can be used to look up an address to a symbolname, and a symbolname to an address
  • TabSheet: Part of a page control
  • TableFile: Tablefiles are files stored into a Cheat Table. You can access the data of such a file using this class
  • Thread:
  • Timer: The timer class is an non visual component that when active triggers an onTimer event every few milliseconds, based on the given interval
  • ToggleBox: The togglebox is like a button, but can stay down. Use with the checkbox methods
  • TrackBar: The trackbar class is a slider you can drag arround and read/set the state
  • TreeNode:
  • TreeNodes:
  • Treeview:
  • WinControl: Base class for controls which can contain other controls.
  • xmplayer:


SQL Classes[edit]


Class Helper Functions[edit]

Undefined Class Property Functions[edit]

Not all properties of all classes have been explicitly exposed to lua, but if you know the name of a property of a specific class you can still access them (assuming they are declared as published in the pascal class declaration)

  • getPropertyList: Returns a StringList object containing all the published properties of the specified class
  • setProperty: Sets the value of a published property of a class (Won't work for method properties)
  • getProperty: Gets the value of a published property of a class (Won't work for method properties)
  • setMethodProperty: Sets the method property to the specific function
  • getMethodProperty: Returns a function you can use to call the original function