Skip to main content

to_lua_string

Function to_lua_string 

Source
pub fn to_lua_string(
    state: &mut LuaState,
    idx: i32,
) -> Result<Vec<u8>, LuaError>
Expand description

Convert the value at idx to its display byte-string, push the result onto the stack, and return its bytes. Mirrors C’s luaL_tolstring: the __tostring metamethod is honored (and, from 5.3, the __name metafield names the type for reference values).

This is a thin wrapper over lua_vm::state::LuaState::to_display_string, the single implementation of the conversion, so tables/functions/userdata/ threads render as "kind: 0x<addr>" with a real per-value identity — two distinct values print distinct addresses, matching the reference.