Skip to main content

Crate lua_rs_hlua_shim

Crate lua_rs_hlua_shim 

Source
Expand description

A drop-in subset of the hlua 0.4 embedding API, backed by the pure-Rust lua-rs VM instead of the C library.

The goal is source compatibility: a consumer that does use lua_rs_hlua_shim as hlua; should compile and run against lua-rs without touching its own code. The implemented surface is the part exercised by authoscopeLua, functionN, AnyLuaValue and friends, LuaFunction, and StringInLua. It is intentionally not the whole hlua API.

Sandboxing note: lua-rs’s runtime opens the full standard library, whereas hlua consumers typically open only string. This is acceptable for a compatibility spike but widens the sandbox; restricting the opened libraries is tracked as future work.

Structs§

AnyLuaString
A byte string that may not be valid UTF-8, mirroring hlua::AnyLuaString.
FnHandle
The concrete L we instantiate LuaFunction with: a live borrow of the VM plus the global name to call.
Lua
A Lua state with the standard libraries installed.
LuaError
Error returned by Lua::execute and LuaFunction::call_with_args.
LuaFunction
A handle to a global Lua function, kept by name so it can be re-fetched and called. Mirrors hlua::LuaFunction<L> (single type parameter).
StringInLua
Mirror of hlua::StringInLua<L>: owns the read string and derefs to str.

Enums§

AnyHashableLuaValue
The hashable projection used for Lua table keys, mirroring hlua::AnyHashableLuaValue. Numbers narrow to i32 exactly as upstream.
AnyLuaValue
Any Lua value, mirroring hlua::AnyLuaValue field-for-field.

Traits§

FromExec
The result type produced by Lua::execute. Only () is supported, which is all authoscope requires.

Functions§

function0
Wrap a Rust closure so it can be stored as a Lua global via Lua::set.
function1
Wrap a Rust closure so it can be stored as a Lua global via Lua::set.
function2
Wrap a Rust closure so it can be stored as a Lua global via Lua::set.
function3
Wrap a Rust closure so it can be stored as a Lua global via Lua::set.
function4
Wrap a Rust closure so it can be stored as a Lua global via Lua::set.
function5
Wrap a Rust closure so it can be stored as a Lua global via Lua::set.
function6
Wrap a Rust closure so it can be stored as a Lua global via Lua::set.