pub fn num_to_string(
state: &mut LuaState,
val: &LuaValue,
) -> Result<GcRef<LuaString>, LuaError>Expand description
Converts a numeric LuaValue to an interned LuaString, returning a
GcRef<LuaString> handle. Callers are responsible for updating the
LuaValue (or stack slot) with LuaValue::Str(s).
in place; in Rust we return the string because holding &mut LuaValue
across a state.intern_str call would borrow state twice.
Integers stringify through a stack buffer so the common case (and the
number-coercion arm of OP_CONCAT) allocates nothing beyond the interned
string itself; floats stay on the existing formatting path, which produces
the identical bytes.