pub type TempLua = Lua<Close>;
Expand description
A temporary lua context that will be closed when dropped.
Aliased Type§
pub struct TempLua { /* private fields */ }
Implementations§
Source§impl TempLua
impl TempLua
Sourcepub fn new() -> Self
pub fn new() -> Self
Builds a new empty TempLua context.
There are no global variables and the registry is totally empty. Even the functions from the standard library can’t be used.
If you want to use the Lua standard library in the scripts of this context, see the openlibs method
§Example
use tlua::Lua;
let lua = Lua::new();
§Panic
The function panics if the underlying call to lua_newstate
fails
(which indicates lack of memory).
Sourcepub unsafe fn from_existing<T>(lua: *mut T) -> Self
pub unsafe fn from_existing<T>(lua: *mut T) -> Self
Takes an existing lua_State
and build a TemplLua object from it.
lua_close
will be called on the lua_State
in drop.
§Safety
A pointer to a valid lua
context must be provided which is ok to be
closed.