Difference between revisions of "Lua:getNameFromAddress"
Jump to navigation
Jump to search
m |
|||
| Line 1: | Line 1: | ||
[[Category:Lua]] | [[Category:Lua]] | ||
| − | '''function''' getNameFromAddress('' | + | {{CodeBox|'''function''' getNameFromAddress(''address'', ''ModuleNames'', ''Symbols'', ''Sections'') ''':''' string}} |
| − | Returns the given address as a string | + | Returns the given address as a string. |
| − | Depending on the address and the options, | + | |
| + | Depending on the address and the enabled lookup options, the returned string can be a registered symbol name, a module name with offset, a section name with offset, or a hexadecimal address string. | ||
===Function Parameters=== | ===Function Parameters=== | ||
| Line 11: | Line 12: | ||
!style="width: 80%;background-color:white;" align="left"|Description | !style="width: 80%;background-color:white;" align="left"|Description | ||
|- | |- | ||
| − | | | + | |address |
|Integer or [[CEAddressString]] | |Integer or [[CEAddressString]] | ||
| − | |The address to convert to a string. | + | |The address to convert to a readable name string. |
|- | |- | ||
|ModuleNames | |ModuleNames | ||
|Boolean (optional) | |Boolean (optional) | ||
| − | |If true | + | |If true, module names may be used when formatting the returned address string. Defaults to true. |
|- | |- | ||
|Symbols | |Symbols | ||
|Boolean (optional) | |Boolean (optional) | ||
| − | |If true | + | |If true, registered symbols may be used when formatting the returned address string. Defaults to true. |
|- | |- | ||
|Sections | |Sections | ||
|Boolean (optional) | |Boolean (optional) | ||
| − | |If true, | + | |If true, section names may be used when formatting the returned address string. Defaults to false. |
|} | |} | ||
===Returns=== | ===Returns=== | ||
| − | + | string — The given address represented as a readable string. | |
===Examples=== | ===Examples=== | ||
<pre> | <pre> | ||
| − | + | local address = getAddress("KERNEL32.AddAtomA") | |
| − | local name = getNameFromAddress( | + | local name = getNameFromAddress(address) |
| + | |||
print(name) | print(name) | ||
| − | + | </pre> | |
| + | |||
| + | <pre> | ||
| + | local address = getAddress("KERNEL32.AddAtomA") | ||
| − | -- | + | -- Allow module names and symbols, but do not include section names |
| − | local | + | local name = getNameFromAddress(address, true, true, false) |
| − | print( | + | |
| − | -- | + | print(name) |
| + | </pre> | ||
| + | |||
| + | <pre> | ||
| + | local address = getAddress("KERNEL32.AddAtomA") | ||
| + | |||
| + | -- Return a more raw representation by disabling module names, symbols, and sections | ||
| + | local name = getNameFromAddress(address, false, false, false) | ||
| + | |||
| + | print(name) | ||
</pre> | </pre> | ||
Revision as of 04:17, 21 June 2026
Returns the given address as a string.
Depending on the address and the enabled lookup options, the returned string can be a registered symbol name, a module name with offset, a section name with offset, or a hexadecimal address string.
Function Parameters
| Parameter | Type | Description |
|---|---|---|
| address | Integer or CEAddressString | The address to convert to a readable name string. |
| ModuleNames | Boolean (optional) | If true, module names may be used when formatting the returned address string. Defaults to true. |
| Symbols | Boolean (optional) | If true, registered symbols may be used when formatting the returned address string. Defaults to true. |
| Sections | Boolean (optional) | If true, section names may be used when formatting the returned address string. Defaults to false. |
Returns
string — The given address represented as a readable string.
Examples
local address = getAddress("KERNEL32.AddAtomA")
local name = getNameFromAddress(address)
print(name)
local address = getAddress("KERNEL32.AddAtomA")
-- Allow module names and symbols, but do not include section names
local name = getNameFromAddress(address, true, true, false)
print(name)
local address = getAddress("KERNEL32.AddAtomA")
-- Return a more raw representation by disabling module names, symbols, and sections
local name = getNameFromAddress(address, false, false, false)
print(name)