Difference between revisions of "Lua:enumModules"
Jump to navigation
Jump to search
(→Related Functions) |
m (Added CodeBox Template.) |
||
| Line 1: | Line 1: | ||
[[Category:Lua]] | [[Category:Lua]] | ||
| − | '''function''' enumModules(''ProcessID'' OPTIONAL) | + | {{CodeBox|'''function''' enumModules(''ProcessID'' OPTIONAL) ''':''' table}} |
| − | Returns a table containing information about each module in the current process, or the specified | + | 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 === | === Function Parameters === | ||
| − | + | {|width="85%" cellpadding="5%" cellspacing="0" border="0" | |
| − | {|width="85 | ||
!align="left"|Parameter | !align="left"|Parameter | ||
!align="left"|Type | !align="left"|Type | ||
| Line 12: | Line 17: | ||
|- | |- | ||
|ProcessID | |ProcessID | ||
| − | | | + | |Integer |
| − | |The process | + | |Optional. The process ID to enumerate modules from. Defaults to the currently opened process. |
|} | |} | ||
| + | === Example === | ||
| + | <pre> | ||
| + | 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) | ||
| + | ]] | ||
| + | </pre> | ||
| − | + | {{LuaSeeAlso}} | |
| − | |||
| − | |||
| − | + | {{Process}} | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
Latest revision as of 00:57, 5 December 2025
| <> 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 |