Difference between revisions of "Lua:getAddress"

From Cheat Engine
Jump to navigation Jump to search
(Created page with ''''function''' getAddress(''AddressString'') Passes the given string to Cheat Engine's symbol handler and returns the corresponding address as an integer ===Function Parameters…')
 
m
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
'''function''' getAddress(''AddressString'')
+
[[Category:Lua]]
 +
'''function''' getAddress(''String'', [''Local'']) ''':''' Integer
  
Passes the given string to Cheat Engine's symbol handler and returns the corresponding address as an integer
+
Returns the address of a symbol, module, or export. 
 +
If <code>Local</code> is true, queries the symbol table of the Cheat Engine process itself.
  
 
===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
+
|String
|[[CEAddressString]]
+
|String
|The addressstring to convert to an integer
+
|The symbol, module name, or export to resolve to an address.
 +
|-
 +
|Local
 +
|Boolean (optional)
 +
|If true, queries the symbol table of the Cheat Engine process. Default is false (target process).
 
|}
 
|}
  
 +
===Returns===
 +
Integer — The resolved address, or nil if not found.
 +
 +
===Examples===
 +
<pre>
 +
-- Get the address of a registered symbol in the target process
 +
registerSymbol("MySymbol", 0x401000)
 +
local symAddr = getAddress("MySymbol")
 +
print(string.format("MySymbol = 0x%X", symAddr))
 +
 +
-- Get the address of a symbol in the target process
 +
local ceAddr = getAddress("cheatengine-x86_64-SSE4-AVX2.exe+5000")
 +
print(string.format("CE process address = 0x%X", ceAddr))
 +
</pre>
 +
 +
{{LuaSeeAlso}}
  
== See also ==
+
=== Related Functions ===
* [[Lua]]
+
* [[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 19:46, 11 July 2025

function getAddress(String, [Local]) : Integer

Returns the address of a symbol, module, or export. If Local is true, queries the symbol table of the Cheat Engine process itself.

Function Parameters[edit]

Parameter Type Description
String String The symbol, module name, or export to resolve to an address.
Local Boolean (optional) If true, queries the symbol table of the Cheat Engine process. Default is false (target process).

Returns[edit]

Integer — The resolved address, or nil if not found.

Examples[edit]

-- Get the address of a registered symbol in the target process
registerSymbol("MySymbol", 0x401000)
local symAddr = getAddress("MySymbol")
print(string.format("MySymbol = 0x%X", symAddr))

-- Get the address of a symbol in the target process
local ceAddr = getAddress("cheatengine-x86_64-SSE4-AVX2.exe+5000")
print(string.format("CE process address = 0x%X", ceAddr))

See also[edit]

Related Functions[edit]