Lua:getAddressSafe

From Cheat Engine
Revision as of 04:36, 21 June 2026 by Leunsel (talk | contribs)
Jump to navigation Jump to search

<> Lua API Reference

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.

Function Parameters

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

integer or nil — The resolved address of the given symbol, or nil if the symbol could not be found.

Examples

local address = getAddressSafe("KERNEL32.AddAtomA")

if address ~= nil then
  print(string.format("%X", address))
else
  print("Symbol could not be resolved")
end

Main Pages

Core Lua documentation entry points

Lua
Script Engine