Skip to main content

Module string

Module string 

Source
Expand description

Lua strings: immutable byte sequences allocated in one block (header + inline bytes). Short strings (≤ 40 bytes, PUC LUAI_MAXSHORTLEN) are interned in the heap’s string table: equality is pointer equality. Long strings hash lazily, seeded per-heap (hash-flooding defense for hostile script workloads (script host)).

Structs§

LuaStr
Lua string object — header plus inline byte payload. Byte-clean (Lua strings are arbitrary byte sequences, not necessarily UTF-8). Access the bytes via Gc<LuaStr>::as_bytes.

Constants§

MAX_SHORT_LEN
Strings up to this byte length are interned in the heap’s string table; longer strings are heap-individual and hashed lazily.