Struct luaext::types::table::LuaTable
[−]
[src]
pub struct LuaTable { /* fields omitted */ }Represents a Lua table on the Lua stack.
Methods
impl LuaTable[src]
fn new(i: Index) -> LuaTable
Create a new LuaTable at the given index.
fn set_metatable(&self, context: &mut Context, meta: &LuaTable)
Set this table's metatable.
Equivalent to the Lua setmetatable function
fn set(&self, context: &mut Context, key: &ToLua, value: &ToLua)
Set a value in this table May call the __newindex metamethod
Equivalent to table[key] = value in Lua
fn set_raw(&self, context: &mut Context, key: &ToLua, value: &ToLua)
Set a value in this table without invoking metamethods
Equivalent to the Lua rawset function
fn get(&self, context: &mut Context, key: &ToLua) -> LuaGeneric
Get a value from this table May call the __index metamethod
Equivalent to table[key] in Lua
fn get_raw(&self, context: &mut Context, key: &ToLua) -> LuaGeneric
Get a value from this table without invoking metamethods
Equivalent to the Lua rawget function
fn get_typed<T: FromLua>(&self, context: &mut Context, key: &ToLua) -> Option<T>
Get a value from this table as type T
fn len(&self, context: &mut Context) -> i64
Count the number of elements in this table as an array
May call the __len metamethod
Equivalent to the Lua # operator
Panics
This method will panic if this table has a __len
metamethod that does not return an integer
fn len_raw(&self, context: &mut Context) -> usize
Count the number of elements in this table as an array without calling the __len metamethod
Equivalent to the Lua rawlen function
fn iter_array<F>(&self, context: &mut Context, func: F) where
F: FnMut(Context, i64, LuaGeneric),
F: FnMut(Context, i64, LuaGeneric),
Iterate through every (i, value) pair where i is an integer and is continuous from 1 to this table's length.
Similar to the Lua ipairs function
fn append(&self, context: &mut Context, value: &ToLua)
Add an element to the end of the table
Equivalent to the Lua table.insert function
Trait Implementations
impl LuaStackable for LuaTable[src]
fn get_pos(&self) -> Index
Get the position of this value on the stack
impl ToLua for LuaTable[src]
fn to_lua(&self, state: &mut State)
Pushes a value of type Self onto the stack of a Lua state.