Skip to main content

lua_to_json

Function lua_to_json 

Source
pub fn lua_to_json(_lua: &Lua, val: Value) -> Result<Value, Error>
Expand description

Convert a Lua value to a serde_json::Value.

Round-trips with json_to_lua and std.json.encode (mlua-batteries). Lua nil maps to JSON null. Unsupported types (functions, userdata other than null) yield an error so that callers do not silently emit malformed JSON.