Lua:process

From Cheat Engine
Revision as of 20:24, 25 June 2026 by Leunsel (talk | contribs) (Major overhaul of the post.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

<> Lua API Reference

variable process : string

Contains the main module name of the currently opened process.

Value

String — The main module name of the currently opened process.

If no process is opened, this variable may be empty or not point to a readable module base.

Examples

Print the current process module name

1 print(process)

Check whether Cheat Engine is attached

1 local attached = readInteger(process) ~= nil
2 
3 print("Attached: " .. tostring(attached))

Use process as a module base

1 local base = getAddress(process)
2 
3 print(string.format("%X", base))

Resolve an address relative to the main module

1 local address = getAddress(process .. "+1234")
2 
3 print(string.format("%X", address))

Read a value relative to the main module

1 local value = readInteger(process .. "+1234")
2 
3 print(value)

Guard code until a process is attached

1 if readInteger(process) == nil then
2   print("No readable process module is currently opened")
3   return
4 end
5 
6 print("Attached to: " .. process)

Use process with auto assembler scripts

1 local script = process .. [[+1234:
2   nop
3 ]]
4 
5 autoAssemble(script)

Compare process with a target name

1 if process == "game.exe" then
2   print("The target process is open")
3 end

Main Pages

Core Lua documentation entry points

Lua
Script Engine