SplitScript reference / Process / readUtf8

Process.readUtf8

Method

Process.readUtf8(address: address, maxBytes: u32) -> String!

Reads a bounded NUL-terminated UTF-8 string.

At most maxBytes are read in one host operation. Decoding stops at the first NUL byte. Failed memory access, an excessive bound, or invalid UTF-8 returns an error. After decoding, the result is an ordinary garbage-collected String; the bound belongs to this read operation and is not part of the result's type.

Parameters

  • address: The address of the first UTF-8 byte.
  • maxBytes: The maximum number of bytes to read, up to 4096.

Effects: reads process memory, requires an attached process

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

Examples

Read a native map name

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