Skip to main content

LuaTable

Struct LuaTable 

Source
pub struct LuaTable { /* private fields */ }
Expand description

Represents a table stored in the Lua context.

Loading this type mutably borrows the Lua context.

Implementations§

Source§

impl LuaTable

Source

pub fn into_inner(self) -> *mut lua_State

Destroys the LuaTable and returns its inner Lua context. Useful when it takes Lua by value.

Source

pub fn iter<K, V>(&mut self) -> LuaTableIterator<'_, K, V>

Iterates over the elements inside the table.

Source

pub fn query<'a, R, I>(&'a mut self, index: I) -> Option<R>
where R: LuaRead, I: LuaPush,

Loads a value in the table given its index.

Source

pub fn set<I, V>(&mut self, index: I, value: V)
where I: LuaPush, V: LuaPush,

Inserts or modifies an elements of the table.

Source

pub fn register<I>( &mut self, index: I, func: extern "C" fn(*mut lua_State) -> c_int, )
where I: LuaPush,

Inserts or modifies an elements of the table.

Source

pub fn empty_table<I>(&mut self, index: I) -> LuaTable
where I: LuaPush + Clone,

Source

pub fn table_len(&mut self) -> usize

Source

pub fn get_or_create_metatable(&mut self) -> LuaTable

Trait Implementations§

Source§

impl Drop for LuaTable

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl LuaRead for LuaTable

Source§

fn lua_read_with_pop( lua: *mut lua_State, index: i32, pop: i32, ) -> Option<LuaTable>

Reads the data from Lua at a given position.
Source§

fn lua_read(lua: *mut lua_State) -> Option<Self>

Reads the data from Lua.
Source§

fn lua_read_at_position(lua: *mut lua_State, index: i32) -> Option<Self>

Reads the data from Lua at a given position.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.