Lua:executeCode

From Cheat Engine
Revision as of 05:06, 21 June 2026 by Leunsel (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

⚠️ Work Needed

This page still needs significant improvements.

Please help by expanding or correcting this article where possible.

For suggestions or discussion, see the talk page.

<> Lua API Reference

function executeCode(address, parameter, timeout) : address

Executes a stdcall function at the given address in the target process and waits for it to return.

This function supports one optional parameter. The return value is the result of the function that was called.

For more advanced calls, multiple parameters, explicit parameter types, or different calling conventions, use executeCodeEx.

Function Parameters[edit]

Parameter Type Description
address Integer or CEAddressString The address of the stdcall function to execute in the target process.
parameter Any (optional) The optional parameter to pass to the function.
timeout Integer (optional) The number of milliseconds to wait for the function to return.

Returns[edit]

address — The return value of the function that was called.

Examples[edit]

local functionAddress = getAddress("SomeFunction")

local result = executeCode(functionAddress)

print("Result: " .. tostring(result))
local functionAddress = getAddress("SomeFunction")

local result = executeCode(functionAddress, 123)

print("Result: " .. tostring(result))
local functionAddress = getAddress("SomeFunction")

-- Wait up to 1000 milliseconds for the function to return
local result = executeCode(functionAddress, 123, 1000)

print("Result: " .. tostring(result))

Main Pages

Core Lua documentation entry points

Lua
Script Engine