SplitScript reference / MemoryReader / readUtf8

MemoryReader.readUtf8

Method

Self.readUtf8(address: Address, maxBytes: u32) -> String! where Self: MemoryReader

Reads a bounded NUL-terminated UTF-8 string.

At most maxBytes are read in one operation. Decoding stops at the first NUL byte. Failed memory access, a zero or excessive bound, or invalid UTF-8 returns an error. The result is an ordinary immutable String.

Parameters

  • address: Address of the first UTF-8 byte.
  • maxBytes: Maximum number of bytes to read, from 1 through 4096.

Effects: allocates, reads process memory, requires an attached process

Runtime behavior: available while a process is attached, except in onDetach; synchronous

Examples

Read a map name from native process memory

let map = process.readUtf8(0x1000, 32) else "Unknown"