Struct ezlua::value::LuaUserData
source · pub struct LuaUserData<'l>(/* private fields */);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
pub fn uservalues(&self) -> Result<Vec<ValRef<'_>>>
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_pointer(&self) -> *mut c_void
pub unsafe fn userdata_bytes(&self) -> &[u8] ⓘ
pub unsafe fn get_ref_unchecked<U: UserData>(&self) -> Option<&mut U::Trans>
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 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 to_pointer(&self) -> *const c_void
pub fn to_cstr_ptr(&self) -> *const c_char
pub fn check_type(&self, ty: Type) -> Result<()>
pub fn check_type2(&self, ty1: Type, ty2: Type) -> Result<()>
sourcepub fn cast<T: FromLua<'a> + 'static>(&self) -> Result<T>
pub fn cast<T: FromLua<'a> + 'static>(&self) -> Result<T>
Alias to cast_into(), not take the ownship, but only convert to static-lifetime types
sourcepub fn geti(&self, i: impl Into<lua_Integer>) -> Result<ValRef<'a>>
pub fn geti(&self, i: impl Into<lua_Integer>) -> Result<ValRef<'a>>
Get value associated to integer key, equivalent to return self[i] in lua
sourcepub fn seti<V: ToLua>(&self, i: impl Into<lua_Integer>, v: V) -> Result<()>
pub fn seti<V: ToLua>(&self, i: impl Into<lua_Integer>, v: V) -> Result<()>
Set value with integer key, equivalent to self[i] = v in lua
sourcepub fn len(&self) -> Result<ValRef<'a>>
pub fn len(&self) -> Result<ValRef<'a>>
Get length of the value, equivalent to return #self in lua
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 with any key, equivalent to self[k] = v in lua
sourcepub fn get<K: ToLua>(&self, key: K) -> Result<ValRef<'a>>
pub fn get<K: ToLua>(&self, key: K) -> Result<ValRef<'a>>
Get value associated to key, equivalent to return self[k] in lua
pub fn getopt<K: ToLua, V: FromLua<'a> + '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
pub fn call_close_and_remove_metatable(&self) -> Result<()>
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>>
pub fn airth_add(&self, rhs: impl ToLua) -> Result<Self>
pub fn airth_sub(&self, rhs: impl ToLua) -> Result<Self>
pub fn airth_mul(&self, rhs: impl ToLua) -> Result<Self>
pub fn airth_div(&self, rhs: impl ToLua) -> Result<Self>
pub fn airth_rem(&self, rhs: impl ToLua) -> Result<Self>
pub fn airth_bitand(&self, rhs: impl ToLua) -> Result<Self>
pub fn airth_bitor(&self, rhs: impl ToLua) -> Result<Self>
pub fn airth_bitxor(&self, rhs: impl ToLua) -> Result<Self>
pub fn airth_shl(&self, rhs: impl ToLua) -> Result<Self>
pub fn airth_shr(&self, rhs: impl ToLua) -> Result<Self>
pub fn arith_neg(&self) -> Result<Self>
pub fn arith_not(&self) -> Result<Self>
pub fn idiv(&self, rhs: impl ToLua) -> Result<Self>
pub fn pow(&self, rhs: impl ToLua) -> Result<Self>
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>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more