Lua:readStringLocal

From Cheat Engine
Revision as of 20:39, 24 June 2026 by Leunsel (talk | contribs)
Jump to navigation Jump to search

<> Lua API Reference

function readStringLocal(Address, MaxLength, [WideChar]) : String

Reads a string from the specified address in Cheat Engine's own process memory (not the target process) until a 0-terminator is encountered. The maximum number of characters to read is limited by MaxLength to prevent freezing. Set WideChar to true if the string is encoded using widechar (UTF-16/Unicode) formatting.

Function Parameters

Parameter Type Description
Address Integer or CEAddressString The address in Cheat Engine's memory to read from.
MaxLength Integer The maximum number of characters to read (prevents infinite loops).
WideChar Boolean (optional) Set to true to read as a widechar (UTF-16/Unicode) string. Default is false (ASCII/ANSI).

Returns

String — The string read from the specified address.

Examples

-- Read an ASCII string from address 0x123456 in CE's memory, up to 100 characters
local str = readStringLocal(0x123456, 100)
print("String:", str)

-- Read a widechar (Unicode) string from a CEAddressString
local wstr = readStringLocal("00400000+10", 256, true)
print("Wide string:", wstr)

Main Pages

Core Lua documentation entry points

Lua
Script Engine

String Related Lua Functions

Encoding conversion and localized text helpers