pub struct Lua { /* private fields */ }Expand description
Primary owned embedding handle.
Lua is intentionally cheap to clone and single-threaded. State access is
borrowed at the embedding boundary only; opcode dispatch still runs with
direct &mut LuaState access. Captured Rust callbacks will need a call-path
adapter that releases this boundary borrow before invoking user code.
Implementations§
Source§impl Lua
impl Lua
Sourcepub fn with_hooks(hooks: HostHooks) -> Result<Self>
pub fn with_hooks(hooks: HostHooks) -> Result<Self>
Create a Lua runtime with the supplied host capabilities.
Sourcepub fn create_table(&self) -> Result<Table>
pub fn create_table(&self) -> Result<Table>
Create a new empty table.
Sourcepub fn create_string(&self, bytes: impl AsRef<[u8]>) -> Result<LuaString>
pub fn create_string(&self, bytes: impl AsRef<[u8]>) -> Result<LuaString>
Create a new Lua string from bytes.
pub fn create_function<A, R, F>(&self, func: F) -> Result<Function>
pub fn create_function_mut<A, R, F>(&self, func: F) -> Result<Function>where
A: FromLuaMulti + 'static,
R: IntoLuaMulti + 'static,
F: FnMut(&Lua, A) -> Result<R> + 'static,
pub fn create_userdata<T>(&self, data: T) -> Result<AnyUserData>where
T: UserData,
Sourcepub fn gc_collect(&self)
pub fn gc_collect(&self)
Run a full garbage-collection cycle.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Lua
impl !RefUnwindSafe for Lua
impl !Send for Lua
impl !Sync for Lua
impl Unpin for Lua
impl UnsafeUnpin for Lua
impl !UnwindSafe for Lua
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more