Lua:getHandleList
Revision as of 04:58, 21 June 2026 by Leunsel (talk | contribs) (Created page with "Category:Lua {{CodeBox|'''function''' getHandleList(''filter'') ''':''' table}} Returns a table containing handles from the system. The optional ''filter'' parameter con...")
Returns a table containing handles from the system.
The optional filter parameter controls which handles are returned. Each handle entry contains information such as the owning process ID, object type index, handle value, object address, and granted access rights.
Calling this function without a filter returns all handles in the system, which can be a very large amount of data.
Note: The Object field will be invalid when using the 32-bit version of Cheat Engine on a 64-bit Windows system.
Function Parameters
| Parameter | Type | Description |
|---|---|---|
| filter | Integer (optional) | Controls which handles are returned. 0 returns everything, 1 returns target process handles only, 2 returns handles to the target process, and 3 returns handles to the Cheat Engine process. |
Returns
table — A table containing handle entries.
Filter Values
| Value | Meaning | Description |
|---|---|---|
| 0 | Everything | Returns all handles in the system. This can return a very large amount of entries. |
| 1 | Target process handles only | Returns handles owned by the currently opened target process. |
| 2 | Handles to target process | Returns handles that point to the currently opened target process. |
| 3 | Handles to Cheat Engine process | Returns handles that point to the Cheat Engine process. |
Handle Entry Fields
| Field | Type | Description |
|---|---|---|
| ProcessID | Integer | The ID of the process that owns the handle. |
| ObjectTypeIndex | Integer | The object type index of the handle. |
| HandleAttributes | Integer | The attributes associated with the handle. |
| HandleValue | Integer | The numeric value of the handle. |
| Object | Integer | The object address associated with the handle. This field will be invalid when using 32-bit Cheat Engine on a 64-bit Windows system. |
| GrantedAccess | Integer | The granted access mask for the handle. |
Examples
-- Get handles owned by the currently opened target process
local handles = getHandleList(1)
print("Handle count: " .. tostring(#handles))
local maxResults = math.min(#handles, 10)
for i = 1, maxResults do
local handle = handles[i]
print("Process ID: " .. tostring(handle.ProcessID))
print("Handle: " .. string.format("%X", handle.HandleValue))
print("Granted access: " .. string.format("%X", handle.GrantedAccess))
end
-- Get handles to the currently opened target process
local handles = getHandleList(2)
print("Handle count: " .. tostring(#handles))
for i = 1, math.min(#handles, 10) do
local handle = handles[i]
print("Owner process ID: " .. tostring(handle.ProcessID))
print("Handle: " .. string.format("%X", handle.HandleValue))
end