Difference between revisions of "Lua:getAddressSafe"
Jump to navigation
Jump to search
Mr millchick (talk | contribs) (added more detailed documentation as well as examples and comparison with getAddress) |
m (Added related function template.) |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
[[Category:Lua]] | [[Category:Lua]] | ||
| − | '''function''' getAddressSafe('' | + | {{CodeBox|'''function''' getAddressSafe(''symbolname'', ''local'', ''shallow'') ''':''' integer}} |
| − | + | Returns the address of a symbol, or nil if the symbol could not be resolved. | |
| − | + | This function is similar to using getAddress with errorOnLookup set to false, but returns nil instead of raising an error when the symbol is not found. | |
| − | + | The symbol can be a registered symbol, a module name, or an exported symbol. Set ''local'' to true to query the symbol table of the Cheat Engine process instead of the currently opened target process. | |
| − | {|width="85%" cellpadding="10 | + | ===Function Parameters=== |
| + | {|width="85%" cellpadding="10%" cellspacing="0" border="0" | ||
!align="left"|Parameter | !align="left"|Parameter | ||
!align="left"|Type | !align="left"|Type | ||
| − | !style="width: 80%;" align="left"|Description | + | !style="width: 80%;background-color:white;" align="left"|Description |
|- | |- | ||
| − | | | + | |symbolname |
| − | | | + | |String |
| − | |The symbol | + | |The symbol, module name, or exported symbol to resolve. |
|- | |- | ||
|local | |local | ||
| − | | | + | |Boolean (optional) |
| − | | | + | |If true, queries the symbol table of the Cheat Engine process. |
|- | |- | ||
|shallow | |shallow | ||
| − | | | + | |Boolean (optional) |
| − | | | + | |If true, performs a shallow lookup. |
|} | |} | ||
| + | ===Returns=== | ||
| + | integer or nil — The resolved address of the given symbol, or nil if the symbol could not be found. | ||
| − | === | + | ===Examples=== |
| − | + | <syntaxhighlight lang="lua" line> | |
| − | + | local address = getAddressSafe("KERNEL32.AddAtomA") | |
| − | = | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| + | if address ~= nil then | ||
| + | print(string.format("%X", address)) | ||
| + | else | ||
| + | print("Symbol could not be resolved") | ||
| + | end | ||
| + | </syntaxhighlight> | ||
{{LuaSeeAlso}} | {{LuaSeeAlso}} | ||
| − | + | {{Address}} | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
Latest revision as of 22:48, 26 June 2026
Returns the address of a symbol, or nil if the symbol could not be resolved.
This function is similar to using getAddress with errorOnLookup set to false, but returns nil instead of raising an error when the symbol is not found.
The symbol can be a registered symbol, a module name, or an exported symbol. Set local to true to query the symbol table of the Cheat Engine process instead of the currently opened target process.
Function Parameters[edit]
| Parameter | Type | Description |
|---|---|---|
| symbolname | String | The symbol, module name, or exported symbol to resolve. |
| local | Boolean (optional) | If true, queries the symbol table of the Cheat Engine process. |
| shallow | Boolean (optional) | If true, performs a shallow lookup. |
Returns[edit]
integer or nil — The resolved address of the given symbol, or nil if the symbol could not be found.
Examples[edit]
1 local address = getAddressSafe("KERNEL32.AddAtomA")
2
3 if address ~= nil then
4 print(string.format("%X", address))
5 else
6 print("Symbol could not be resolved")
7 end