pub struct LuaModule<'a, 'b> { /* private fields */ }Expand description
(Sub-)module in a LuaMachine (which is a Lua table)
The type LuaModule is used to implement the abstract Module trait
which allows getting and setting variables (through Module::get and
Module::set, respectively) a module (in this case: in a Lua table).
A LuaModule may be obtained by calling HasModules::module on the
LuaMachine (to obtain a top-level module/table) or Module::module
on a LuaModule (to obtain a sub module/table, respectively).
To set global variables, use Globals::get and Globals::set directly
on the LuaMachine instead.
§Lifetimes
Lifetime argument 'a corresponds to the lifetime argument 'a of
LuaMachine. It is a lower bound for closures passed to the Lua machine.
Lifetime argument 'b corresponds to the lifetime of the shared reference
to the LuaMachine being worked with.
Trait Implementations§
Source§impl<'a, 'b> Module<'a, 'b> for LuaModule<'a, 'b>
impl<'a, 'b> Module<'a, 'b> for LuaModule<'a, 'b>
Source§fn module(&self, name: &str) -> Result<Self, MachineError>
fn module(&self, name: &str) -> Result<Self, MachineError>
Open a sub-module (create if non-existent)
Source§fn get(
&self,
name: &str,
) -> Result<<Self::Machine as Machine<'a>>::Datum<'b, 'static>, MachineError>
fn get( &self, name: &str, ) -> Result<<Self::Machine as Machine<'a>>::Datum<'b, 'static>, MachineError>
Get value from module
Source§fn set<'c>(
&self,
name: &str,
datum: <Self::Machine as Machine<'a>>::Datum<'b, 'c>,
) -> Result<(), MachineError>
fn set<'c>( &self, name: &str, datum: <Self::Machine as Machine<'a>>::Datum<'b, 'c>, ) -> Result<(), MachineError>
Set value in module