Type Alias TempLua

Source
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

Source

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).

Source

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.

Trait Implementations§

Source§

impl Default for TempLua

Source§

fn default() -> Self

Returns the “default value” for a type. Read more