Difference between revisions of "Lua:getNameFromAddress"
Jump to navigation
Jump to search
m |
|||
(6 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | '''function''' getNameFromAddress('' | + | [[Category:Lua]] |
+ | '''function''' getNameFromAddress(''Address'', [''ModuleNames''], [''Symbols''], [''Sections'']) ''':''' String | ||
− | Returns | + | Returns the given address as a string representation. |
+ | Depending on the address and the options, this may return a registered symbol name, <code>modulename+offset</code>, or just a hexadecimal string. | ||
===Function Parameters=== | ===Function Parameters=== | ||
− | {|width="85%" cellpadding="10 | + | {|width="85%" cellpadding="10%" cellspacing="0" border="0" |
!align="left"|Parameter | !align="left"|Parameter | ||
!align="left"|Type | !align="left"|Type | ||
!style="width: 80%;background-color:white;" align="left"|Description | !style="width: 80%;background-color:white;" align="left"|Description | ||
|- | |- | ||
− | | | + | |Address |
− | |[[CEAddressString]] | + | |Integer or [[CEAddressString]] |
− | |The address to convert to a string | + | |The address to convert to a string. |
+ | |- | ||
+ | |ModuleNames | ||
+ | |Boolean (optional) | ||
+ | |If true (default), allows returning <code>modulename+offset</code> if possible. | ||
+ | |- | ||
+ | |Symbols | ||
+ | |Boolean (optional) | ||
+ | |If true (default), allows returning registered symbol names if available. | ||
+ | |- | ||
+ | |Sections | ||
+ | |Boolean (optional) | ||
+ | |If true, allows returning section names. Default is false. | ||
|} | |} | ||
+ | ===Returns=== | ||
+ | String — The string representation of the address. | ||
+ | |||
+ | ===Examples=== | ||
+ | <pre> | ||
+ | -- Get the name for an address, preferring symbols and module names | ||
+ | local name = getNameFromAddress(0x401000) | ||
+ | print(name) | ||
+ | -- cheatengine-x86_64-SSE4-AVX2.exe+1000 | ||
+ | |||
+ | -- Only return hexadecimal if no symbol or module name is available | ||
+ | local hexOnly = getNameFromAddress(0x401000, false, false) | ||
+ | print(hexOnly) | ||
+ | -- 00401000 | ||
+ | </pre> | ||
− | + | {{LuaSeeAlso}} | |
− | |||
− | |||
=== Related Functions === | === Related Functions === | ||
− | * [[getAddress]] | + | * [[Lua:getAddress|getAddress]] |
− | * [[getCommonModuleList]] | + | * [[Lua:getCommonModuleList|getCommonModuleList]] |
− | * [[inModule]] | + | * [[Lua:inModule|inModule]] |
− | * [[inSystemModule]] | + | * [[Lua:inSystemModule|inSystemModule]] |
− | * [[targetIs64Bit]] | + | * [[Lua:targetIs64Bit|targetIs64Bit]] |
− | * [[enumModules]] | + | * [[Lua:enumModules|enumModules]] |
Latest revision as of 19:38, 11 July 2025
function getNameFromAddress(Address, [ModuleNames], [Symbols], [Sections]) : String
Returns the given address as a string representation.
Depending on the address and the options, this may return a registered symbol name, modulename+offset
, or just a hexadecimal string.
Function Parameters[edit]
Parameter | Type | Description |
---|---|---|
Address | Integer or CEAddressString | The address to convert to a string. |
ModuleNames | Boolean (optional) | If true (default), allows returning modulename+offset if possible.
|
Symbols | Boolean (optional) | If true (default), allows returning registered symbol names if available. |
Sections | Boolean (optional) | If true, allows returning section names. Default is false. |
Returns[edit]
String — The string representation of the address.
Examples[edit]
-- Get the name for an address, preferring symbols and module names local name = getNameFromAddress(0x401000) print(name) -- cheatengine-x86_64-SSE4-AVX2.exe+1000 -- Only return hexadecimal if no symbol or module name is available local hexOnly = getNameFromAddress(0x401000, false, false) print(hexOnly) -- 00401000