Lua:enumModules

From Cheat Engine
Revision as of 00:57, 5 December 2025 by Leunsel (talk | contribs) (Added CodeBox Template.)
Jump to navigation Jump to search

<> Lua API Reference

function enumModules(ProcessID OPTIONAL) : table

Returns a table containing information about each module in the current process, or in the specified `ProcessID`. Each entry is a table with the following fields:

  • Name — String containing the module name
  • Address — Integer representing the base address where the module is loaded
  • Is64Bit — Boolean; true if the module is 64-bit
  • PathToFile — String containing the file path of the module

Function Parameters

Parameter Type Description
ProcessID Integer Optional. The process ID to enumerate modules from. Defaults to the currently opened process.

Example

local mods = enumModules()
for i, mod in ipairs(mods) do
  print(string.format("%s: 0x%X - %d bytes (%s)", mod.Name, mod.Address, mod.Size or 0, mod.Is64Bit and "x64" or "x86"))
end

-- Output:
--[[
cheatengine-x86_64-SSE4-AVX2.exe: 0x400000 - 0 bytes (x64) 
ntdll.dll: 0x7FF8CF150000 - 0 bytes (x64) 
KERNEL32.DLL: 0x7FF8CE660000 - 0 bytes (x64) 
KERNELBASE.dll: 0x7FF8CC860000 - 0 bytes (x64) 
apphelp.dll: 0x7FF8C9CA0000 - 0 bytes (x64) 
oleaut32.dll: 0x7FF8CE1B0000 - 0 bytes (x64) 
msvcp_win.dll: 0x7FF8CCDB0000 - 0 bytes (x64) 
]]

Main Pages

Core Lua documentation entry points

Lua
Script Engine

Process Open / Creation

Process Lists / Modules

Process Control / Target State