Struct luaext::types::userdata::LuaUserdata
[−]
[src]
pub struct LuaUserdata { /* fields omitted */ }Represents user-defined data on the Lua stack
Note that without a __gc metamethod, any data contained in the userdata that implements the Drop trait will not be dropped, which although not unsafe, may result in memory leaks. This includes types such as HashMap and Vec.
Methods
impl LuaUserdata[src]
fn new(i: Index) -> LuaUserdata
Create a new LuaUserdata at the given index
fn set_metatable(&self, context: &mut Context, meta: &LuaTable)
Set this userdata's metatable.
unsafe fn get_value<'a, T>(&self, context: &'a mut Context) -> Option<&'a mut T>
Get a mutable reference to this userdata's contained data.
unsafe fn get_value_named<'a, T>(
&self,
context: &'a mut Context,
name: &str
) -> Option<&'a mut T>
&self,
context: &'a mut Context,
name: &str
) -> Option<&'a mut T>
Get a mutable reference to this userdata's contained data, given that its metatable matches the given name.
Trait Implementations
impl LuaStackable for LuaUserdata[src]
fn get_pos(&self) -> Index
Get the position of this value on the stack
impl ToLua for LuaUserdata[src]
fn to_lua(&self, state: &mut State)
Pushes a value of type Self onto the stack of a Lua state.
impl FromLua for LuaUserdata[src]
fn from_lua(state: &mut State, index: Index) -> Option<LuaUserdata>
Converts the value on top of the stack of a Lua state to a value of type Option<Self>. Read more