Struct ezlua::value::LuaUserData
source · pub struct LuaUserData<'l>(_);Expand description
Represents a lua userdata on the stack
Implementations§
source§impl<'a> LuaUserData<'a>
impl<'a> LuaUserData<'a>
sourcepub fn set_uservalue<V: ToLua>(&self, v: V) -> Result<()>
pub fn set_uservalue<V: ToLua>(&self, v: V) -> Result<()>
Set uservalue
sourcepub fn get_uservalue(&self) -> Result<ValRef<'a>>
pub fn get_uservalue(&self) -> Result<ValRef<'a>>
Get the uservalue stored in uservalue
sourcepub fn get_iuservalue(&self, n: i32) -> Result<ValRef<'a>>
pub fn get_iuservalue(&self, n: i32) -> Result<ValRef<'a>>
Get n-th uservalue stored in uservalue
sourcepub fn take<U: UserData>(self) -> Option<U::Trans>
pub fn take<U: UserData>(self) -> Option<U::Trans>
Take the ownership, and subsequent access in lua is invalid
pub fn userdata_ref<U: UserData>(&self) -> Option<&U::Trans>
pub unsafe fn userdata_ref_mut<U: UserData>(&self) -> Option<&mut U::Trans>
Methods from Deref<Target = ValRef<'l>>§
sourcepub fn deserialize<T: Deserialize<'a>>(&'a self) -> Result<T, DesErr>
pub fn deserialize<T: Deserialize<'a>>(&'a self) -> Result<T, DesErr>
deserialize a lua value
sourcepub fn transcode<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>
pub fn transcode<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>
transcode a lua value to another serialize format
pub fn state(&self) -> &'a State
pub fn type_of(&self) -> Type
pub fn is_nil(&self) -> bool
pub fn is_integer(&self) -> bool
pub fn is_table(&self) -> bool
pub fn is_function(&self) -> bool
pub fn check_safe_index(&self) -> Result<()>
pub fn to_safe_bytes(&self) -> Result<&'a [u8]>
pub fn to_safe_str(&self) -> Result<&'a str>
pub fn to_bytes(&self) -> Option<&[u8]>
pub fn to_str(&self) -> Option<&str>
pub fn to_string_lossy(&self) -> Option<Cow<'_, str>>
pub fn to_bool(&self) -> bool
pub fn to_integer(&self) -> lua_Integer
pub fn to_number(&self) -> lua_Number
pub fn index(&self) -> Index
pub fn check_type(&self, ty: Type) -> Result<()>
pub fn check_type2(&self, ty1: Type, ty2: Type) -> Result<()>
pub fn cast<'v, T: FromLua<'a> + 'v>(&'v self) -> Result<T>
pub fn geti(&self, i: impl Into<lua_Integer>) -> Result<ValRef<'a>>
pub fn seti<V: ToLua>(&self, i: impl Into<lua_Integer>, v: V) -> Result<()>
sourcepub fn set<K: ToLua, V: ToLua>(&self, k: K, v: V) -> Result<()>
pub fn set<K: ToLua, V: ToLua>(&self, k: K, v: V) -> Result<()>
Set value, equivalent to self[k] = v in lua
sourcepub fn get<K: ToLua>(&self, k: K) -> Result<ValRef<'a>>
pub fn get<K: ToLua>(&self, k: K) -> Result<ValRef<'a>>
Get value associated, equivalent to return self[k] in lua
pub fn getopt<K: ToLua, V: FromLua<'a>>(&self, k: K) -> Result<Option<V>>
sourcepub fn pcall<T: ToLuaMulti, R: FromLuaMulti<'a>>(&self, args: T) -> Result<R>
pub fn pcall<T: ToLuaMulti, R: FromLuaMulti<'a>>(&self, args: T) -> Result<R>
Call this value as a function
sourcepub fn pcall_void<T: ToLuaMulti>(&self, args: T) -> Result<()>
pub fn pcall_void<T: ToLuaMulti>(&self, args: T) -> Result<()>
Invoke pcall() without return value
pub fn has_metatable(&self) -> bool
sourcepub fn set_metatable(&self, t: Table<'_>) -> Result<()>
pub fn set_metatable(&self, t: Table<'_>) -> Result<()>
Set metatable for lua table or userdata
sourcepub fn remove_metatable(&self)
pub fn remove_metatable(&self)
Remove metatable for lua table or userdata
sourcepub fn call_metamethod<T: ToLuaMulti, R: FromLuaMulti<'a>>(
&self,
m: &str,
args: T
) -> Result<R>
pub fn call_metamethod<T: ToLuaMulti, R: FromLuaMulti<'a>>( &self, m: &str, args: T ) -> Result<R>
Call a metamethod
sourcepub fn raw_equal(&self, other: &Self) -> bool
pub fn raw_equal(&self, other: &Self) -> bool
Tests whether two lua values are equal without metamethod triggers
sourcepub fn raw_len(&self) -> usize
pub fn raw_len(&self) -> usize
Get length of the string/userdata/table without metamethod triggers
pub fn as_table(&self) -> Option<&Table<'a>>
pub fn as_function(&self) -> Option<&Function<'a>>
pub fn as_string(&self) -> Option<&LuaString<'a>>
pub fn as_thread(&self) -> Option<&LuaThread<'a>>
pub fn as_userdata(&self) -> Option<&LuaUserData<'a>>
Trait Implementations§
source§impl<'l> Clone for LuaUserData<'l>
impl<'l> Clone for LuaUserData<'l>
source§fn clone(&self) -> LuaUserData<'l>
fn clone(&self) -> LuaUserData<'l>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl<'l> Debug for LuaUserData<'l>
impl<'l> Debug for LuaUserData<'l>
source§impl<'l> Deref for LuaUserData<'l>
impl<'l> Deref for LuaUserData<'l>
source§impl<'a> FromLua<'a> for LuaUserData<'a>
impl<'a> FromLua<'a> for LuaUserData<'a>
source§impl<'a> Into<ValRef<'a>> for LuaUserData<'a>
impl<'a> Into<ValRef<'a>> for LuaUserData<'a>
source§impl<'a> ToLua for LuaUserData<'a>
impl<'a> ToLua for LuaUserData<'a>
Auto Trait Implementations§
impl<'l> !RefUnwindSafe for LuaUserData<'l>
impl<'l> !Send for LuaUserData<'l>
impl<'l> !Sync for LuaUserData<'l>
impl<'l> Unpin for LuaUserData<'l>
impl<'l> !UnwindSafe for LuaUserData<'l>
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