pub struct Lua<'lua> { /* private fields */ }Expand description
A Lua state with the standard libraries installed.
The 'lua parameter mirrors hlua’s signature so consumer code that writes
Lua<'a> keeps compiling; the shim itself owns its state outright.
Implementations§
Source§impl<'lua> Lua<'lua>
impl<'lua> Lua<'lua>
Sourcepub fn new() -> Lua<'lua>
pub fn new() -> Lua<'lua>
Create a new Lua state with the standard libraries installed. Panics
only on allocation failure, matching the effective behaviour of
hlua::Lua::new().
Stdlib install runs inside a heap bootstrap window (guard + scope),
mirroring the runtime crate’s bootstrap_state: without it every
library table and closure allocates detached and outlives the state —
issue #249’s leak class, which stayed live on this lane after the
main runtime was fixed.
Sourcepub fn open_string(&mut self)
pub fn open_string(&mut self)
Open the string library. omniLua already opens the full standard library at construction, so this is a no-op kept for API compatibility.
Sourcepub fn execute<T: FromExec>(&mut self, code: &str) -> Result<T, LuaError>
pub fn execute<T: FromExec>(&mut self, code: &str) -> Result<T, LuaError>
Load and run a chunk of Lua source.