Skip to main content

Module string

Module string 

Source
Expand description

Bootstrap string table used only to construct the pre-allocated out-of-memory message during VM startup.

LuaStringImpl/StringPool mirror C’s TString/stringtable (lstring.c/lstring.h), but nothing outside this module ever calls [new_lstr] again after [init] runs once at startup: general Lua string values and their interning go through lua_types::LuaString and GlobalState::interned_lt (see state.rs). GlobalState::strt — the StringPool this module maintains — ends up holding exactly one entry, the memory-error message, for the life of the process.

Structs§

LuaStringImpl
A Lua string: an immutable, reference-counted byte sequence. Corresponds to C’s TString.
LuaUserDataImpl
Corresponds to C’s Udata: a GC-tracked object carrying a raw byte payload plus optional Lua user values and an optional metatable.
StringPool
Intern table for short Lua strings. Lives on GlobalState.

Enums§

StringKind
Whether a Lua string is short (interned) or long (not interned).