Lua:enumModules

From Cheat Engine
Revision as of 00:57, 5 December 2025 by Leunsel (talk | contribs) (Added CodeBox Template.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
<> Function

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

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

Example[edit]

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) 
]]

See also[edit]

Lua
Script Engine

Related Functions[edit]

createProcess
openProcess
onOpenProcess
getForegroundProcess
getOpenedProcessID
getProcessIDFromProcessName
openFileAsProcess
saveOpenedFile
setPointerSize
setAssemblerMode
getProcesslist
getWindowlist
pause
unpause
targetIs64Bit
enumModules
closeRemoteHandle