Difference between revisions of "Lua:getAddress"

From Cheat Engine
Jump to navigation Jump to search
m (Added related function template.)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
[[Category:Lua]]
 
[[Category:Lua]]
'''function''' getAddress(''AddressString'', ''local'' OPTIONAL) ''':''' integer
+
{{CodeBox|'''function''' getAddress(''string'', ''local'') ''':''' integer}}
  
Passes the given string to Cheat Engine's symbol handler and returns the corresponding address as an integer. Can be a module name or an export. Set ''local'' to true if you wish to query the symbol table of the CE process.
+
Returns the address of a symbol.
 
 
If errorOnLookupFailure is set to true (the default value), if you look up a symbol that does not exist, it will throw an error. With errorOnLookupFailure set to false, it will return 0.
 
  
 +
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===
 
===Function Parameters===
{|width="85%" cellpadding="10%" cellpadding="5%" cellspacing="0" border="0"
+
{|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
 
|-
 
|-
|AddressString
+
|symbolname
|[[CEAddressString]]
+
|String or [[CEAddressString]]
|The AddressString to convert to an integer
+
|The symbol, module name, or exported symbol to resolve.
 
|-
 
|-
 
|local
 
|local
|Boolean
+
|Boolean (optional)
|Set to true if you wish to query the symbol table of the CE process
+
|If true, queries the symbol table of the Cheat Engine process.
 
|}
 
|}
  
 +
===Returns===
 +
integer — The resolved address of the given symbol.
 +
 +
===Examples===
 +
<syntaxhighlight lang="lua" line>
 +
local address = getAddress("KERNEL32.AddAtomA")
 +
 +
print(string.format("%X", address))
 +
</syntaxhighlight>
  
 
{{LuaSeeAlso}}
 
{{LuaSeeAlso}}
  
=== Related Functions ===
+
{{Address}}
* [[Lua:getAddressSafe|getAddressSafe]]
 
* [[Lua:getNameFromAddress|getNameFromAddress]]
 
* [[Lua:getCommonModuleList|getCommonModuleList]]
 
* [[Lua:inModule|inModule]]
 
* [[Lua:inSystemModule|inSystemModule]]
 
* [[Lua:targetIs64Bit|targetIs64Bit]]
 
* [[Lua:enumModules|enumModules]]
 

Latest revision as of 22:48, 26 June 2026

<> Lua API Reference

function getAddress(string, local) : integer

Returns the address of a symbol.

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 or CEAddressString The symbol, module name, or exported symbol to resolve.
local Boolean (optional) If true, queries the symbol table of the Cheat Engine process.

Returns[edit]

integer — The resolved address of the given symbol.

Examples[edit]

1 local address = getAddress("KERNEL32.AddAtomA")
2 
3 print(string.format("%X", address))

Main Pages

Core Lua documentation entry points

Lua
Script Engine

Symbol Related Lua Functions

Symbol lookup, address resolution, module checks, and lookup callbacks