pub struct Indexable<L> { /* private fields */ }
Expand description
An opaque value on lua stack that can be indexed. Can represent a lua
table, a lua table with a __index
metamethod or other indexable lua
value.
Use this type when reading return values from lua functions or getting lua function from tables.
Trait Implementations§
source§impl<L> AsLua for Indexable<L>where
L: AsLua,
impl<L> AsLua for Indexable<L>where
L: AsLua,
fn as_lua(&self) -> LuaState
source§fn try_push<T>(
self,
v: T,
) -> Result<PushGuard<Self>, (<T as PushInto<Self>>::Err, Self)>
fn try_push<T>( self, v: T, ) -> Result<PushGuard<Self>, (<T as PushInto<Self>>::Err, Self)>
Try to push
v
onto the lua stack. Read moresource§fn try_push_one<T>(
self,
v: T,
) -> Result<PushGuard<Self>, (<T as PushInto<Self>>::Err, Self)>where
Self: Sized,
T: PushOneInto<Self>,
fn try_push_one<T>(
self,
v: T,
) -> Result<PushGuard<Self>, (<T as PushInto<Self>>::Err, Self)>where
Self: Sized,
T: PushOneInto<Self>,
Try to push
v
onto the lua stack. Read moresource§fn push_iter<I>(self, iterator: I) -> Result<PushGuard<Self>, Self>
fn push_iter<I>(self, iterator: I) -> Result<PushGuard<Self>, Self>
Push
iterator
onto the lua stack as a lua table. Read moresource§fn try_push_iter<I>(
self,
iterator: I,
) -> Result<PushGuard<Self>, (PushIterErrorOf<I>, Self)>
fn try_push_iter<I>( self, iterator: I, ) -> Result<PushGuard<Self>, (PushIterErrorOf<I>, Self)>
Push
iterator
onto the lua stack as a lua table. Read morefn read<T>(self) -> ReadResult<T, Self>
fn read_at<T>(self, index: i32) -> ReadResult<T, Self>
fn read_at_nz<T>(self, index: NonZeroI32) -> ReadResult<T, Self>
source§impl<L> Index<L> for Indexable<L>where
L: AsLua,
impl<L> Index<L> for Indexable<L>where
L: AsLua,
source§fn get<'lua, K, R>(&'lua self, key: K) -> Option<R>
fn get<'lua, K, R>(&'lua self, key: K) -> Option<R>
Loads a value from the table (or other object using the
__index
metamethod) given its index
. Read moresource§fn try_get<'lua, K, R>(&'lua self, key: K) -> Result<R, LuaError>
fn try_get<'lua, K, R>(&'lua self, key: K) -> Result<R, LuaError>
Loads a value from the table (or other object using the
__index
metamethod) given its index
. Read moresource§fn into_get<K, R>(self, key: K) -> Result<R, Self>
fn into_get<K, R>(self, key: K) -> Result<R, Self>
Loads a value in the table (or other object using the
__index
metamethod) given its index
, with the result capturing the table by
value. Read moresource§fn try_into_get<K, R>(self, key: K) -> Result<R, (Self, LuaError)>
fn try_into_get<K, R>(self, key: K) -> Result<R, (Self, LuaError)>
Loads a value in the table (or other object using the
__index
metamethod) given its index
, with the result capturing the table by
value. Read moresource§fn call_method<'lua, A, R>(
&'lua self,
name: &str,
args: A,
) -> Result<R, MethodCallError<A::Err>>
fn call_method<'lua, A, R>( &'lua self, name: &str, args: A, ) -> Result<R, MethodCallError<A::Err>>
Calls the method called
name
of the table (or other indexable object)
with the provided args
. Read moresource§impl<L> LuaRead<L> for Indexable<L>where
L: AsLua,
impl<L> LuaRead<L> for Indexable<L>where
L: AsLua,
source§fn lua_read_at_position(lua: L, index: NonZeroI32) -> ReadResult<Self, L>
fn lua_read_at_position(lua: L, index: NonZeroI32) -> ReadResult<Self, L>
Reads the data from Lua at a given position.
fn n_values_expected() -> i32
source§fn lua_read(lua: L) -> ReadResult<Self, L>
fn lua_read(lua: L) -> ReadResult<Self, L>
Reads the data from Lua.
fn lua_read_at_maybe_zero_position(lua: L, index: i32) -> ReadResult<Self, L>where
L: AsLua,
source§impl<L, T> Push<L> for Indexable<T>
impl<L, T> Push<L> for Indexable<T>
source§fn push_to_lua(&self, lua: L) -> PushResult<L, Self>
fn push_to_lua(&self, lua: L) -> PushResult<L, Self>
Pushes the value on the top of the stack. Read more
impl<L, T> PushOne<L> for Indexable<T>
Auto Trait Implementations§
impl<L> Freeze for Indexable<L>where
L: Freeze,
impl<L> RefUnwindSafe for Indexable<L>where
L: RefUnwindSafe,
impl<L> Send for Indexable<L>where
L: Send,
impl<L> Sync for Indexable<L>where
L: Sync,
impl<L> Unpin for Indexable<L>where
L: Unpin,
impl<L> UnwindSafe for Indexable<L>where
L: UnwindSafe,
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