pub struct Thread { /* private fields */ }Expand description
A non-owning Luau thread handle.
Thread does not keep the VM alive and does not encode exclusive access
to the VM stack. It is deliberately !Send and !Sync through its raw
state representation.
§Safety model for unsafe methods
Unless a method documents stricter requirements, every unsafe Thread
operation requires a live thread belonging to a live VM. Stack indices,
stack shapes, counts, tags, and pointer arguments must satisfy the
corresponding Luau API operation’s contract. The caller must provide
sufficient stack capacity where the operation does not grow the stack,
prevent reentrant or concurrent access to VM-owned records, and treat any
operation that can allocate or execute code as a possible GC transition.
Returned pointers and raw handles are non-owning and may be invalidated by
stack relocation, collection, closure, reset, or VM destruction.
Implementations§
Source§impl Thread
impl Thread
Sourcepub unsafe fn open_bit32(&self) -> NativeCallResult
pub unsafe fn open_bit32(&self) -> NativeCallResult
luaopen_bit32
Source§impl Thread
impl Thread
Sourcepub unsafe fn open_buffer(&self) -> NativeCallResult
pub unsafe fn open_buffer(&self) -> NativeCallResult
luaopen_buffer
Source§impl Thread
impl Thread
Sourcepub unsafe fn open_class(&self) -> NativeCallResult
pub unsafe fn open_class(&self) -> NativeCallResult
luaopen_class
Source§impl Thread
impl Thread
Sourcepub unsafe fn open_coroutine(&self) -> NativeCallResult
pub unsafe fn open_coroutine(&self) -> NativeCallResult
luaopen_coroutine
Source§impl Thread
impl Thread
Sourcepub unsafe fn open_debug(&self) -> NativeCallResult
pub unsafe fn open_debug(&self) -> NativeCallResult
luaopen_debug
Source§impl Thread
impl Thread
Sourcepub unsafe fn open_integer(&self) -> NativeCallResult
pub unsafe fn open_integer(&self) -> NativeCallResult
luaopen_integer
Source§impl Thread
impl Thread
Sourcepub unsafe fn open_string(&self) -> NativeCallResult
pub unsafe fn open_string(&self) -> NativeCallResult
luaopen_string
Source§impl Thread
impl Thread
Sourcepub unsafe fn open_table(&self) -> NativeCallResult
pub unsafe fn open_table(&self) -> NativeCallResult
luaopen_table
Source§impl Thread
impl Thread
Sourcepub unsafe fn open_vector(&self) -> NativeCallResult
pub unsafe fn open_vector(&self) -> NativeCallResult
luaopen_vector
Source§impl Thread
impl Thread
Source§impl Thread
impl Thread
Sourcepub unsafe fn push_where(&self, level: i32) -> VmErrorResult
pub unsafe fn push_where(&self, level: i32) -> VmErrorResult
luaL_where
Sourcepub unsafe fn lua_error<'a, T>(
&self,
format: impl AsRef<[u8]>,
args: impl AsMut<[Arg<'a>]>,
) -> VmErrorResult<T>
pub unsafe fn lua_error<'a, T>( &self, format: impl AsRef<[u8]>, args: impl AsMut<[Arg<'a>]>, ) -> VmErrorResult<T>
luaL_error
Sourcepub unsafe fn lua_type_error<T>(
&self,
argument: i32,
expected_type: impl AsRef<[u8]>,
) -> VmErrorResult<T>
pub unsafe fn lua_type_error<T>( &self, argument: i32, expected_type: impl AsRef<[u8]>, ) -> VmErrorResult<T>
luaL_typeerror
Sourcepub unsafe fn lua_arg_expected(
&self,
condition: bool,
argument: i32,
expected_type: &str,
) -> VmErrorResult
pub unsafe fn lua_arg_expected( &self, condition: bool, argument: i32, expected_type: &str, ) -> VmErrorResult
luaL_argexpected
Sourcepub unsafe fn lua_arg_error<T>(
&self,
argument: i32,
message: impl AsRef<[u8]>,
) -> VmErrorResult<T>
pub unsafe fn lua_arg_error<T>( &self, argument: i32, message: impl AsRef<[u8]>, ) -> VmErrorResult<T>
luaL_argerror
Source§impl Thread
impl Thread
Sourcepub unsafe fn lua_check_stack(
&self,
size: i32,
message: Option<&str>,
) -> VmErrorResult
pub unsafe fn lua_check_stack( &self, size: i32, message: Option<&str>, ) -> VmErrorResult
luaL_checkstack
Sourcepub unsafe fn check_type(
&self,
argument: i32,
expected_type: i32,
) -> VmErrorResult
pub unsafe fn check_type( &self, argument: i32, expected_type: i32, ) -> VmErrorResult
luaL_checktype
Sourcepub unsafe fn check_any(&self, argument: i32) -> VmErrorResult
pub unsafe fn check_any(&self, argument: i32) -> VmErrorResult
luaL_checkany
Sourcepub unsafe fn check_string(&self, argument: i32) -> VmErrorResult<&BStr>
pub unsafe fn check_string(&self, argument: i32) -> VmErrorResult<&BStr>
luaL_checklstring
Sourcepub unsafe fn opt_string(&self, argument: i32) -> VmErrorResult<Option<&BStr>>
pub unsafe fn opt_string(&self, argument: i32) -> VmErrorResult<Option<&BStr>>
luaL_optlstring
Sourcepub unsafe fn check_buffer(
&self,
argument: i32,
) -> VmErrorResult<(*mut u8, usize)>
pub unsafe fn check_buffer( &self, argument: i32, ) -> VmErrorResult<(*mut u8, usize)>
luaL_checkbuffer
Sourcepub unsafe fn check_userdata(
&self,
argument: i32,
type_name: &str,
) -> VmErrorResult<*mut ()>
pub unsafe fn check_userdata( &self, argument: i32, type_name: &str, ) -> VmErrorResult<*mut ()>
luaL_checkudata
Sourcepub unsafe fn check_userdata_tagged(
&self,
argument: i32,
tag: i32,
) -> VmErrorResult<*mut ()>
pub unsafe fn check_userdata_tagged( &self, argument: i32, tag: i32, ) -> VmErrorResult<*mut ()>
luaL_checkudatatagged
Sourcepub unsafe fn check_number(&self, argument: i32) -> VmErrorResult<f64>
pub unsafe fn check_number(&self, argument: i32) -> VmErrorResult<f64>
luaL_checknumber
Sourcepub unsafe fn opt_number(
&self,
argument: i32,
default: f64,
) -> VmErrorResult<f64>
pub unsafe fn opt_number( &self, argument: i32, default: f64, ) -> VmErrorResult<f64>
luaL_optnumber
Sourcepub unsafe fn check_boolean(&self, argument: i32) -> VmErrorResult<i32>
pub unsafe fn check_boolean(&self, argument: i32) -> VmErrorResult<i32>
luaL_checkboolean
Sourcepub unsafe fn opt_boolean(
&self,
argument: i32,
default: i32,
) -> VmErrorResult<i32>
pub unsafe fn opt_boolean( &self, argument: i32, default: i32, ) -> VmErrorResult<i32>
luaL_optboolean
Sourcepub unsafe fn check_integer(&self, argument: i32) -> VmErrorResult<i32>
pub unsafe fn check_integer(&self, argument: i32) -> VmErrorResult<i32>
luaL_checkinteger
Sourcepub unsafe fn opt_integer(
&self,
argument: i32,
default: i32,
) -> VmErrorResult<i32>
pub unsafe fn opt_integer( &self, argument: i32, default: i32, ) -> VmErrorResult<i32>
luaL_optinteger
Sourcepub unsafe fn check_integer64(&self, argument: i32) -> VmErrorResult<i64>
pub unsafe fn check_integer64(&self, argument: i32) -> VmErrorResult<i64>
luaL_checkinteger64
Sourcepub unsafe fn opt_integer64(
&self,
argument: i32,
default: i64,
) -> VmErrorResult<i64>
pub unsafe fn opt_integer64( &self, argument: i32, default: i64, ) -> VmErrorResult<i64>
luaL_optinteger64
Sourcepub unsafe fn check_unsigned(&self, argument: i32) -> VmErrorResult<u32>
pub unsafe fn check_unsigned(&self, argument: i32) -> VmErrorResult<u32>
luaL_checkunsigned
Sourcepub unsafe fn opt_unsigned(
&self,
argument: i32,
default: u32,
) -> VmErrorResult<u32>
pub unsafe fn opt_unsigned( &self, argument: i32, default: u32, ) -> VmErrorResult<u32>
luaL_optunsigned
Sourcepub unsafe fn check_vector(&self, argument: i32) -> VmErrorResult<[f32; 3]>
pub unsafe fn check_vector(&self, argument: i32) -> VmErrorResult<[f32; 3]>
luaL_checkvector
Sourcepub unsafe fn opt_vector(
&self,
argument: i32,
) -> VmErrorResult<Option<[f32; 3]>>
pub unsafe fn opt_vector( &self, argument: i32, ) -> VmErrorResult<Option<[f32; 3]>>
luaL_optvector
Sourcepub unsafe fn check_option(
&self,
argument: i32,
default: Option<&str>,
options: &[&str],
) -> VmErrorResult<i32>
pub unsafe fn check_option( &self, argument: i32, default: Option<&str>, options: &[&str], ) -> VmErrorResult<i32>
luaL_checkoption
Source§impl Thread
impl Thread
Sourcepub unsafe fn lua_type_name(&self, index: i32) -> LuaString
pub unsafe fn lua_type_name(&self, index: i32) -> LuaString
luaL_typename
Sourcepub unsafe fn lua_to_string(&self, index: i32) -> VmResult<&BStr>
pub unsafe fn lua_to_string(&self, index: i32) -> VmResult<&BStr>
luaL_tolstring
Source§impl Thread
impl Thread
Sourcepub unsafe fn push_native_closure_k(
&self,
function: RawNativeFunction,
debug_name: Option<&'static str>,
upvalues: i32,
continuation: Option<RawNativeContinuation>,
) -> VmErrorResult
pub unsafe fn push_native_closure_k( &self, function: RawNativeFunction, debug_name: Option<&'static str>, upvalues: i32, continuation: Option<RawNativeContinuation>, ) -> VmErrorResult
lua_pushcclosurek
Sourcepub unsafe fn push_native_function(
&self,
function: RawNativeFunction,
debug_name: Option<&'static str>,
) -> VmErrorResult
pub unsafe fn push_native_function( &self, function: RawNativeFunction, debug_name: Option<&'static str>, ) -> VmErrorResult
lua_pushcfunction
Sourcepub unsafe fn push_native_closure(
&self,
function: RawNativeFunction,
debug_name: Option<&'static str>,
upvalues: i32,
) -> VmErrorResult
pub unsafe fn push_native_closure( &self, function: RawNativeFunction, debug_name: Option<&'static str>, upvalues: i32, ) -> VmErrorResult
lua_pushcclosure
Sourcepub unsafe fn to_native_function(&self, index: i32) -> Option<RawNativeFunction>
pub unsafe fn to_native_function(&self, index: i32) -> Option<RawNativeFunction>
lua_tocfunction
Sourcepub unsafe fn clone_function(&self, index: i32) -> VmErrorResult
pub unsafe fn clone_function(&self, index: i32) -> VmErrorResult
lua_clonefunction
Sourcepub unsafe fn uses_export(&self, index: i32) -> i32
pub unsafe fn uses_export(&self, index: i32) -> i32
lua_usesexport
Source§impl Thread
impl Thread
Sourcepub unsafe fn protected_call(
&self,
n_args: i32,
n_results: i32,
errfunc: i32,
) -> VmResult
pub unsafe fn protected_call( &self, n_args: i32, n_results: i32, errfunc: i32, ) -> VmResult
lua_pcall
Sourcepub unsafe fn protected_native_call(
&self,
function: RawNativeFunction,
userdata: *mut (),
) -> VmResult
pub unsafe fn protected_native_call( &self, function: RawNativeFunction, userdata: *mut (), ) -> VmResult
lua_cpcall
Sourcepub unsafe fn error<T>(&self) -> VmErrorResult<T>
pub unsafe fn error<T>(&self) -> VmErrorResult<T>
lua_error
Sourcepub unsafe fn yield_current(&self, results: i32) -> NativeCallResult
pub unsafe fn yield_current(&self, results: i32) -> NativeCallResult
lua_yield
Sourcepub unsafe fn break_current(&self) -> NativeCallResult
pub unsafe fn break_current(&self) -> NativeCallResult
lua_break
Source§impl Thread
impl Thread
Sourcepub unsafe fn call_yieldable(
&self,
nargs: i32,
nresults: i32,
) -> NativeCallResult
pub unsafe fn call_yieldable( &self, nargs: i32, nresults: i32, ) -> NativeCallResult
luaL_callyieldable
Sourcepub unsafe fn protected_call_yieldable(
&self,
nargs: i32,
nresults: i32,
errfunc: i32,
) -> NativeCallResult
pub unsafe fn protected_call_yieldable( &self, nargs: i32, nresults: i32, errfunc: i32, ) -> NativeCallResult
luaL_pcallyieldable
Source§impl Thread
impl Thread
Sourcepub unsafe fn stack_depth(&self) -> i32
pub unsafe fn stack_depth(&self) -> i32
lua_stackdepth
Sourcepub unsafe fn get_info(
&self,
level: i32,
what: &str,
ar: &mut LuaDebug,
) -> VmErrorResult<i32>
pub unsafe fn get_info( &self, level: i32, what: &str, ar: &mut LuaDebug, ) -> VmErrorResult<i32>
lua_getinfo
Sourcepub unsafe fn get_argument(
&self,
level: i32,
argument: i32,
) -> VmErrorResult<i32>
pub unsafe fn get_argument( &self, level: i32, argument: i32, ) -> VmErrorResult<i32>
lua_getargument
Sourcepub unsafe fn get_local(
&self,
level: i32,
local: i32,
) -> VmErrorResult<Option<LuaString>>
pub unsafe fn get_local( &self, level: i32, local: i32, ) -> VmErrorResult<Option<LuaString>>
lua_getlocal
Sourcepub unsafe fn get_upvalue(
&self,
function_index: i32,
upvalue_index: i32,
) -> VmErrorResult<Option<LuaString>>
pub unsafe fn get_upvalue( &self, function_index: i32, upvalue_index: i32, ) -> VmErrorResult<Option<LuaString>>
lua_getupvalue
Sourcepub unsafe fn set_upvalue(
&self,
function_index: i32,
upvalue_index: i32,
) -> Option<LuaString>
pub unsafe fn set_upvalue( &self, function_index: i32, upvalue_index: i32, ) -> Option<LuaString>
lua_setupvalue
Sourcepub unsafe fn single_step(&self, enabled: i32)
pub unsafe fn single_step(&self, enabled: i32)
lua_singlestep
Sourcepub unsafe fn breakpoint(
&self,
function_index: i32,
line: i32,
enabled: i32,
) -> VmErrorResult<i32>
pub unsafe fn breakpoint( &self, function_index: i32, line: i32, enabled: i32, ) -> VmErrorResult<i32>
lua_breakpoint
Sourcepub unsafe fn has_custom_execution(&self, level: i32) -> i32
pub unsafe fn has_custom_execution(&self, level: i32) -> i32
lua_hascustomexecution
Sourcepub unsafe fn in_custom_execution(&self, level: i32) -> i32
pub unsafe fn in_custom_execution(&self, level: i32) -> i32
lua_incustomexecution
Sourcepub unsafe fn at_breakpoint(&self) -> i32
pub unsafe fn at_breakpoint(&self) -> i32
lua_atbreakpoint
Sourcepub unsafe fn get_coverage(
&self,
function_index: i32,
context: *mut (),
callback: LuaCoverage,
) -> VmErrorResult
pub unsafe fn get_coverage( &self, function_index: i32, context: *mut (), callback: LuaCoverage, ) -> VmErrorResult
lua_getcoverage
Sourcepub unsafe fn get_counters(
&self,
function_index: i32,
context: *mut (),
function_visit: LuaCounterFunction,
counter_visit: LuaCounterValue,
)
pub unsafe fn get_counters( &self, function_index: i32, context: *mut (), function_visit: LuaCounterFunction, counter_visit: LuaCounterValue, )
lua_getcounters
Sourcepub unsafe fn debug_trace(&self) -> VmErrorResult<BString>
pub unsafe fn debug_trace(&self) -> VmErrorResult<BString>
lua_debugtrace
Source§impl Thread
impl Thread
Sourcepub unsafe fn memory_dump(
&self,
output: &mut BString,
category_name: Option<&mut dyn GcCategoryNamer>,
)
pub unsafe fn memory_dump( &self, output: &mut BString, category_name: Option<&mut dyn GcCategoryNamer>, )
lua_memorydump
Sourcepub unsafe fn allocation_rate(&self) -> i64
pub unsafe fn allocation_rate(&self) -> i64
lua_allocationrate
Sourcepub unsafe fn set_mem_cat(&self, category: i32)
pub unsafe fn set_mem_cat(&self, category: i32)
lua_setmemcat
Sourcepub unsafe fn total_bytes(&self, category: i32) -> usize
pub unsafe fn total_bytes(&self, category: i32) -> usize
lua_totalbytes
Source§impl Thread
impl Thread
Sourcepub unsafe fn check_stack(&self, size: i32) -> i32
pub unsafe fn check_stack(&self, size: i32) -> i32
lua_checkstack
Sourcepub unsafe fn raw_check_stack(&self, size: i32) -> VmErrorResult
pub unsafe fn raw_check_stack(&self, size: i32) -> VmErrorResult
lua_rawcheckstack
Sourcepub unsafe fn set_top(&self, index: i32) -> VmErrorResult
pub unsafe fn set_top(&self, index: i32) -> VmErrorResult
lua_settop
Sourcepub unsafe fn restore_top(&self, top: i32)
pub unsafe fn restore_top(&self, top: i32)
Restores the stack top to a previous absolute top.
Sourcepub unsafe fn push_value(&self, index: i32) -> VmErrorResult
pub unsafe fn push_value(&self, index: i32) -> VmErrorResult
lua_pushvalue
Sourcepub unsafe fn x_move(&self, to: &Thread, count: i32) -> VmErrorResult
pub unsafe fn x_move(&self, to: &Thread, count: i32) -> VmErrorResult
lua_xmove
Sourcepub unsafe fn x_push(&self, to: &Thread, index: i32) -> VmErrorResult
pub unsafe fn x_push(&self, to: &Thread, index: i32) -> VmErrorResult
lua_xpush
Source§impl Thread
impl Thread
Sourcepub unsafe fn push_nil(&self) -> VmErrorResult
pub unsafe fn push_nil(&self) -> VmErrorResult
lua_pushnil
Sourcepub unsafe fn push_number(&self, value: f64) -> VmErrorResult
pub unsafe fn push_number(&self, value: f64) -> VmErrorResult
lua_pushnumber
Sourcepub unsafe fn push_integer(&self, value: i32) -> VmErrorResult
pub unsafe fn push_integer(&self, value: i32) -> VmErrorResult
lua_pushinteger
Sourcepub unsafe fn push_integer64(&self, value: i64) -> VmErrorResult
pub unsafe fn push_integer64(&self, value: i64) -> VmErrorResult
lua_pushinteger64
Sourcepub unsafe fn push_unsigned(&self, value: u32) -> VmErrorResult
pub unsafe fn push_unsigned(&self, value: u32) -> VmErrorResult
lua_pushunsigned
Sourcepub unsafe fn push_vector(&self, components: [f32; 3]) -> VmErrorResult
pub unsafe fn push_vector(&self, components: [f32; 3]) -> VmErrorResult
lua_pushvector
Sourcepub unsafe fn push_boolean(&self, value: i32) -> VmErrorResult
pub unsafe fn push_boolean(&self, value: i32) -> VmErrorResult
lua_pushboolean
Sourcepub unsafe fn push_light_userdata_tagged(
&self,
pointer: *mut (),
tag: i32,
) -> VmErrorResult
pub unsafe fn push_light_userdata_tagged( &self, pointer: *mut (), tag: i32, ) -> VmErrorResult
lua_pushlightuserdatatagged
Sourcepub unsafe fn push_light_userdata(&self, pointer: *mut ()) -> VmErrorResult
pub unsafe fn push_light_userdata(&self, pointer: *mut ()) -> VmErrorResult
lua_pushlightuserdata
Sourcepub unsafe fn push_string(&self, bytes: impl AsRef<[u8]>) -> VmErrorResult
pub unsafe fn push_string(&self, bytes: impl AsRef<[u8]>) -> VmErrorResult
lua_pushlstring
Sourcepub unsafe fn push_optional_string(
&self,
bytes: Option<impl AsRef<[u8]>>,
) -> VmErrorResult
pub unsafe fn push_optional_string( &self, bytes: Option<impl AsRef<[u8]>>, ) -> VmErrorResult
lua_pushstring
Sourcepub unsafe fn push_vfstring<'a>(
&self,
format: &str,
args: impl AsMut<[Arg<'a>]>,
) -> VmErrorResult<LuaString>
pub unsafe fn push_vfstring<'a>( &self, format: &str, args: impl AsMut<[Arg<'a>]>, ) -> VmErrorResult<LuaString>
lua_pushvfstring
Sourcepub unsafe fn push_fstring<'a>(
&self,
format: &str,
args: impl AsMut<[Arg<'a>]>,
) -> VmErrorResult<LuaString>
pub unsafe fn push_fstring<'a>( &self, format: &str, args: impl AsMut<[Arg<'a>]>, ) -> VmErrorResult<LuaString>
lua_pushfstring
Source§impl Thread
impl Thread
Sourcepub unsafe fn is_light_userdata(&self, index: i32) -> i32
pub unsafe fn is_light_userdata(&self, index: i32) -> i32
lua_islightuserdata
Sourcepub unsafe fn is_function(&self, index: i32) -> i32
pub unsafe fn is_function(&self, index: i32) -> i32
lua_isfunction
Sourcepub unsafe fn is_boolean(&self, index: i32) -> i32
pub unsafe fn is_boolean(&self, index: i32) -> i32
lua_isboolean
Sourcepub unsafe fn is_none_or_nil(&self, index: i32) -> i32
pub unsafe fn is_none_or_nil(&self, index: i32) -> i32
lua_isnoneornil
Sourcepub unsafe fn is_integer64(&self, index: i32) -> i32
pub unsafe fn is_integer64(&self, index: i32) -> i32
lua_isinteger64
Sourcepub unsafe fn is_native_function(&self, index: i32) -> i32
pub unsafe fn is_native_function(&self, index: i32) -> i32
lua_iscfunction
Sourcepub unsafe fn is_lua_function(&self, index: i32) -> i32
pub unsafe fn is_lua_function(&self, index: i32) -> i32
lua_isLfunction
Sourcepub unsafe fn is_userdata(&self, index: i32) -> i32
pub unsafe fn is_userdata(&self, index: i32) -> i32
lua_isuserdata
Sourcepub unsafe fn to_integer(&self, index: i32) -> Option<i32>
pub unsafe fn to_integer(&self, index: i32) -> Option<i32>
lua_tointegerx
Sourcepub unsafe fn to_unsigned(&self, index: i32) -> Option<u32>
pub unsafe fn to_unsigned(&self, index: i32) -> Option<u32>
lua_tounsignedx
Sourcepub unsafe fn to_boolean(&self, index: i32) -> i32
pub unsafe fn to_boolean(&self, index: i32) -> i32
lua_toboolean
Sourcepub unsafe fn to_integer64(&self, index: i32) -> Option<i64>
pub unsafe fn to_integer64(&self, index: i32) -> Option<i64>
lua_tointeger64
Sourcepub unsafe fn namecall_atom(&self) -> Option<(&BStr, i32)>
pub unsafe fn namecall_atom(&self) -> Option<(&BStr, i32)>
lua_namecallatom
Sourcepub unsafe fn len(&self, index: i32) -> VmResult<f64>
pub unsafe fn len(&self, index: i32) -> VmResult<f64>
Numeric result of the Luau length operator (#).
Sourcepub unsafe fn to_pointer(&self, index: i32) -> *const ()
pub unsafe fn to_pointer(&self, index: i32) -> *const ()
lua_topointer
Source§impl Thread
impl Thread
Sourcepub unsafe fn create_table(
&self,
array_size: usize,
record_size: usize,
) -> VmErrorResult
pub unsafe fn create_table( &self, array_size: usize, record_size: usize, ) -> VmErrorResult
lua_createtable
Sourcepub unsafe fn new_table(&self) -> VmErrorResult
pub unsafe fn new_table(&self) -> VmErrorResult
lua_newtable
Sourcepub unsafe fn get_field(
&self,
index: i32,
key: impl AsRef<[u8]>,
) -> VmResult<i32>
pub unsafe fn get_field( &self, index: i32, key: impl AsRef<[u8]>, ) -> VmResult<i32>
lua_getfield
Sourcepub unsafe fn raw_get_field(
&self,
index: i32,
key: impl AsRef<[u8]>,
) -> VmErrorResult<i32>
pub unsafe fn raw_get_field( &self, index: i32, key: impl AsRef<[u8]>, ) -> VmErrorResult<i32>
lua_rawgetfield
Sourcepub unsafe fn raw_getp_tagged(
&self,
index: i32,
key: *mut (),
tag: i32,
) -> VmErrorResult<i32>
pub unsafe fn raw_getp_tagged( &self, index: i32, key: *mut (), tag: i32, ) -> VmErrorResult<i32>
lua_rawgetptagged
Sourcepub unsafe fn set_readonly(&self, index: i32, enabled: i32)
pub unsafe fn set_readonly(&self, index: i32, enabled: i32)
lua_setreadonly
Sourcepub unsafe fn get_readonly(&self, index: i32) -> i32
pub unsafe fn get_readonly(&self, index: i32) -> i32
lua_getreadonly
Sourcepub unsafe fn set_safe_env(&self, index: i32, enabled: i32)
pub unsafe fn set_safe_env(&self, index: i32, enabled: i32)
lua_setsafeenv
Sourcepub unsafe fn get_metatable(&self, index: i32) -> VmErrorResult<i32>
pub unsafe fn get_metatable(&self, index: i32) -> VmErrorResult<i32>
lua_getmetatable
Sourcepub unsafe fn get_fenv(&self, index: i32) -> VmErrorResult
pub unsafe fn get_fenv(&self, index: i32) -> VmErrorResult
lua_getfenv
Sourcepub unsafe fn raw_set_field(
&self,
index: i32,
key: impl AsRef<[u8]>,
) -> VmErrorResult
pub unsafe fn raw_set_field( &self, index: i32, key: impl AsRef<[u8]>, ) -> VmErrorResult
lua_rawsetfield
Sourcepub unsafe fn set_global(&self, name: impl AsRef<[u8]>) -> VmErrorResult
pub unsafe fn set_global(&self, name: impl AsRef<[u8]>) -> VmErrorResult
lua_setglobal
Sourcepub unsafe fn raw_set(&self, index: i32) -> VmErrorResult
pub unsafe fn raw_set(&self, index: i32) -> VmErrorResult
lua_rawset
Sourcepub unsafe fn raw_seti(&self, index: i32, key: i32) -> VmErrorResult
pub unsafe fn raw_seti(&self, index: i32, key: i32) -> VmErrorResult
lua_rawseti
Sourcepub unsafe fn raw_setp_tagged(
&self,
index: i32,
key: *mut (),
tag: i32,
) -> VmErrorResult
pub unsafe fn raw_setp_tagged( &self, index: i32, key: *mut (), tag: i32, ) -> VmErrorResult
lua_rawsetptagged
Sourcepub unsafe fn set_metatable(&self, index: i32) -> VmErrorResult<i32>
pub unsafe fn set_metatable(&self, index: i32) -> VmErrorResult<i32>
lua_setmetatable
Sourcepub unsafe fn next(&self, index: i32) -> VmErrorResult<i32>
pub unsafe fn next(&self, index: i32) -> VmErrorResult<i32>
lua_next
Sourcepub unsafe fn clear_table(&self, index: i32) -> VmErrorResult
pub unsafe fn clear_table(&self, index: i32) -> VmErrorResult
lua_cleartable
Sourcepub unsafe fn clone_table(&self, index: i32) -> VmErrorResult
pub unsafe fn clone_table(&self, index: i32) -> VmErrorResult
lua_clonetable
Source§impl Thread
impl Thread
Sourcepub unsafe fn get_ref(&self, reference: i32) -> VmErrorResult<i32>
pub unsafe fn get_ref(&self, reference: i32) -> VmErrorResult<i32>
lua_getref
Sourcepub unsafe fn ref_value(&self, index: i32) -> VmErrorResult<i32>
pub unsafe fn ref_value(&self, index: i32) -> VmErrorResult<i32>
lua_ref
Sourcepub unsafe fn unref_value(&self, reference: i32) -> i32
pub unsafe fn unref_value(&self, reference: i32) -> i32
lua_unref
Sourcepub unsafe fn weak_ref_value(&self, index: i32) -> VmErrorResult<i32>
pub unsafe fn weak_ref_value(&self, index: i32) -> VmErrorResult<i32>
lua_weakref
Sourcepub unsafe fn weak_unref_value(&self, reference: i32) -> i32
pub unsafe fn weak_unref_value(&self, reference: i32) -> i32
lua_weakunref
Sourcepub unsafe fn get_weak_ref(&self, reference: i32) -> VmErrorResult<i32>
pub unsafe fn get_weak_ref(&self, reference: i32) -> VmErrorResult<i32>
lua_getweakref
Source§impl Thread
impl Thread
Sourcepub unsafe fn get_metafield(
&self,
index: i32,
event: &str,
) -> VmErrorResult<i32>
pub unsafe fn get_metafield( &self, index: i32, event: &str, ) -> VmErrorResult<i32>
luaL_getmetafield
Sourcepub unsafe fn new_metatable(&self, table_name: &str) -> VmErrorResult<i32>
pub unsafe fn new_metatable(&self, table_name: &str) -> VmErrorResult<i32>
luaL_newmetatable
Sourcepub unsafe fn find_table<'a, T>(
&self,
index: i32,
name: &'a T,
size_hint: usize,
) -> VmErrorResult<Option<&'a [u8]>>
pub unsafe fn find_table<'a, T>( &self, index: i32, name: &'a T, size_hint: usize, ) -> VmErrorResult<Option<&'a [u8]>>
luaL_findtable
Sourcepub unsafe fn register(
&self,
library_name: Option<&str>,
functions: &[NativeFunction],
) -> VmResult
pub unsafe fn register( &self, library_name: Option<&str>, functions: &[NativeFunction], ) -> VmResult
luaL_register
pub unsafe fn register_module(&self, module: &NativeModule) -> VmResult
Source§impl Thread
impl Thread
Sourcepub unsafe fn sandbox(&self) -> VmErrorResult
pub unsafe fn sandbox(&self) -> VmErrorResult
luaL_sandbox
§Safety
The caller must ensure that the current globals table can be made readonly and marked as a safe environment for future loads.
Sourcepub unsafe fn sandbox_thread(&self) -> VmErrorResult
pub unsafe fn sandbox_thread(&self) -> VmErrorResult
luaL_sandboxthread
§Safety
The caller must ensure that the thread can have its globals table
replaced. If bytecode is loaded into the same sandboxed thread
environment more than once, the caller must clear safeenv before the
later load or install a fresh sandboxed environment first.
Source§impl Thread
impl Thread
Sourcepub unsafe fn new_userdata_tagged(
&self,
size: usize,
tag: i32,
) -> VmErrorResult<*mut ()>
pub unsafe fn new_userdata_tagged( &self, size: usize, tag: i32, ) -> VmErrorResult<*mut ()>
lua_newuserdatatagged
Sourcepub unsafe fn new_userdata_tagged_with_metatable(
&self,
size: usize,
tag: i32,
) -> VmErrorResult<*mut ()>
pub unsafe fn new_userdata_tagged_with_metatable( &self, size: usize, tag: i32, ) -> VmErrorResult<*mut ()>
lua_newuserdatataggedwithmetatable
Sourcepub unsafe fn new_userdata_dtor(
&self,
size: usize,
destructor: LuaInlineDestructor,
) -> VmErrorResult<*mut ()>
pub unsafe fn new_userdata_dtor( &self, size: usize, destructor: LuaInlineDestructor, ) -> VmErrorResult<*mut ()>
lua_newuserdatadtor
Sourcepub unsafe fn new_userdata(&self, size: usize) -> VmErrorResult<*mut ()>
pub unsafe fn new_userdata(&self, size: usize) -> VmErrorResult<*mut ()>
lua_newuserdata
Sourcepub unsafe fn to_light_userdata(&self, index: i32) -> *mut ()
pub unsafe fn to_light_userdata(&self, index: i32) -> *mut ()
lua_tolightuserdata
Sourcepub unsafe fn to_light_userdata_tagged(&self, index: i32, tag: i32) -> *mut ()
pub unsafe fn to_light_userdata_tagged(&self, index: i32, tag: i32) -> *mut ()
lua_tolightuserdatatagged
Sourcepub unsafe fn to_userdata(&self, index: i32) -> *mut ()
pub unsafe fn to_userdata(&self, index: i32) -> *mut ()
lua_touserdata
Sourcepub unsafe fn userdata_tag(&self, index: i32) -> i32
pub unsafe fn userdata_tag(&self, index: i32) -> i32
lua_userdatatag
Sourcepub unsafe fn light_userdata_tag(&self, index: i32) -> i32
pub unsafe fn light_userdata_tag(&self, index: i32) -> i32
lua_lightuserdatatag
Sourcepub unsafe fn set_userdata_tag(&self, index: i32, tag: i32)
pub unsafe fn set_userdata_tag(&self, index: i32, tag: i32)
lua_setuserdatatag
Sourcepub unsafe fn set_userdata_dtor(&self, tag: i32, destructor: LuaDestructor)
pub unsafe fn set_userdata_dtor(&self, tag: i32, destructor: LuaDestructor)
lua_setuserdatadtor
Sourcepub unsafe fn get_userdata_dtor(&self, tag: i32) -> Option<LuaDestructor>
pub unsafe fn get_userdata_dtor(&self, tag: i32) -> Option<LuaDestructor>
lua_getuserdatadtor
Sourcepub unsafe fn set_userdata_mark(&self, tag: i32, mark: Option<LuaUserdataMark>)
pub unsafe fn set_userdata_mark(&self, tag: i32, mark: Option<LuaUserdataMark>)
lua_setuserdatamark
The callback runs during garbage collection and must not perform reentrant VM operations. Read-only host state access is permitted.
Sourcepub unsafe fn set_embedder_gc(&self, callback: Option<EmbedderGc>)
pub unsafe fn set_embedder_gc(&self, callback: Option<EmbedderGc>)
lua_setembeddergc
The callback runs during garbage collection and must not perform
reentrant VM operations. When mark is present, the callback may use
it to keep embedder-owned weak references alive for this cycle.
Sourcepub unsafe fn set_userdata_metatable(&self, tag: i32)
pub unsafe fn set_userdata_metatable(&self, tag: i32)
lua_setuserdatametatable
Sourcepub unsafe fn get_userdata_metatable(&self, tag: i32) -> VmErrorResult
pub unsafe fn get_userdata_metatable(&self, tag: i32) -> VmErrorResult
lua_getuserdatametatable
Sourcepub unsafe fn get_userdata_name(&self, tag: i32) -> LuaString
pub unsafe fn get_userdata_name(&self, tag: i32) -> LuaString
lua_getuserdataname
Sourcepub unsafe fn get_light_userdata_name(&self, tag: i32) -> Option<LuaString>
pub unsafe fn get_light_userdata_name(&self, tag: i32) -> Option<LuaString>
lua_getlightuserdataname
Sourcepub unsafe fn register_userdata_direct_access(
&self,
tag: i32,
get: LuaUserdataDirectAccess,
set: LuaUserdataDirectAccess,
namecall: Option<LuaUserdataDirectNamecall>,
) -> i32
pub unsafe fn register_userdata_direct_access( &self, tag: i32, get: LuaUserdataDirectAccess, set: LuaUserdataDirectAccess, namecall: Option<LuaUserdataDirectNamecall>, ) -> i32
lua_registeruserdatadirectaccess
Sourcepub unsafe fn register_userdata_direct_field_get(
&self,
tag: i32,
field: &[u8],
get: LuaUserdataDirectFieldGet,
) -> VmErrorResult
pub unsafe fn register_userdata_direct_field_get( &self, tag: i32, field: &[u8], get: LuaUserdataDirectFieldGet, ) -> VmErrorResult
lua_registeruserdatadirectfieldget
Sourcepub unsafe fn set_light_userdata_name(
&self,
tag: i32,
name: &str,
) -> VmErrorResult
pub unsafe fn set_light_userdata_name( &self, tag: i32, name: &str, ) -> VmErrorResult
lua_setlightuserdataname
Source§impl Thread
impl Thread
Sourcepub unsafe fn global(&self) -> GlobalState
pub unsafe fn global(&self) -> GlobalState
Returns a non-owning handle to this thread’s global VM state.
§Safety
This thread and its owning VM must still be live. The returned handle does not extend the global state’s lifetime or establish a borrow of the underlying record.
Source§impl Thread
impl Thread
Sourcepub unsafe fn same_vm(&self, other: impl AsRef<Thread>) -> bool
pub unsafe fn same_vm(&self, other: impl AsRef<Thread>) -> bool
Returns whether both handles belong to the same VM.
§Safety
Both threads and their owning VMs must still be live.
Sourcepub unsafe fn encode_pointer(&self, pointer: usize) -> usize
pub unsafe fn encode_pointer(&self, pointer: usize) -> usize
lua_encodepointer
Sourcepub unsafe fn set_pointer_encode_key(&self, a: u64, b: u64, c: u64, d: u64)
pub unsafe fn set_pointer_encode_key(&self, a: u64, b: u64, c: u64, d: u64)
lua_setpointerencodekey
Sourcepub unsafe fn reset(&self) -> VmErrorResult
pub unsafe fn reset(&self) -> VmErrorResult
lua_resetthread
Sourcepub unsafe fn is_yieldable(&self) -> i32
pub unsafe fn is_yieldable(&self) -> i32
lua_isyieldable
Sourcepub unsafe fn thread_data(&self) -> *mut ()
pub unsafe fn thread_data(&self) -> *mut ()
lua_getthreaddata
Sourcepub unsafe fn set_thread_data(&self, data: *mut ())
pub unsafe fn set_thread_data(&self, data: *mut ())
lua_setthreaddata
Sourcepub unsafe fn callbacks(&self) -> *mut LuaCallbacks
pub unsafe fn callbacks(&self) -> *mut LuaCallbacks
lua_callbacks
Returns the VM-owned callback record address. Mutating this record is only valid while the VM is quiescent, and the update must not be observable in a partially written state. The record is non-atomic and the pointer is not a cross-thread interruption mechanism.
§Safety
The thread and its VM must remain live. The caller must not dereference a stale pointer or read or write the record concurrently with VM execution.
Source§impl Thread
impl Thread
Sourcepub unsafe fn push_thread(&self) -> VmErrorResult<i32>
pub unsafe fn push_thread(&self) -> VmErrorResult<i32>
lua_pushthread
Sourcepub unsafe fn new_thread(&self) -> VmErrorResult<Thread>
pub unsafe fn new_thread(&self) -> VmErrorResult<Thread>
lua_newthread
Trait Implementations§
Source§impl BufferRuntime for Thread
impl BufferRuntime for Thread
Source§unsafe fn new_buffer_internal(&self, size: usize) -> VmErrorResult<Buffer>
unsafe fn new_buffer_internal(&self, size: usize) -> VmErrorResult<Buffer>
luaB_newbuffer
Source§unsafe fn free_buffer(&self, buffer: Buffer, page: LuaPage)
unsafe fn free_buffer(&self, buffer: Buffer, page: LuaPage)
luaB_freebuffer
Source§impl CallRuntime for Thread
impl CallRuntime for Thread
Source§unsafe fn perform_cally(
&self,
function: TValueCursor,
n_results: i32,
) -> VmResult
unsafe fn perform_cally( &self, function: TValueCursor, n_results: i32, ) -> VmResult
luaD_performcally
Source§unsafe fn call_int(
&self,
function: TValueCursor,
n_results: i32,
prepare_reentry: bool,
) -> VmResult
unsafe fn call_int( &self, function: TValueCursor, n_results: i32, prepare_reentry: bool, ) -> VmResult
luaD_callint
Source§unsafe fn call_internal(
&self,
function: TValueCursor,
n_results: i32,
) -> VmResult
unsafe fn call_internal( &self, function: TValueCursor, n_results: i32, ) -> VmResult
luaD_call
Source§unsafe fn call_no_yield(
&self,
function: TValueCursor,
n_results: i32,
) -> VmResult
unsafe fn call_no_yield( &self, function: TValueCursor, n_results: i32, ) -> VmResult
luaD_callny
Source§impl ClassRuntime for Thread
impl ClassRuntime for Thread
Source§unsafe fn new_blank_class(&self, name: TString) -> VmErrorResult<Class>
unsafe fn new_blank_class(&self, name: TString) -> VmErrorResult<Class>
luaR_newblankclass
Source§unsafe fn add_class_metatable(&self, class: Class) -> VmErrorResult
unsafe fn add_class_metatable(&self, class: Class) -> VmErrorResult
luaR_addclassmetatable
Source§unsafe fn new_class(
&self,
name: TString,
members_to_offset: Table,
offset_to_member: *mut TString,
number_of_instance_members: u32,
number_of_static_members: u32,
) -> VmErrorResult<Class>
unsafe fn new_class( &self, name: TString, members_to_offset: Table, offset_to_member: *mut TString, number_of_instance_members: u32, number_of_static_members: u32, ) -> VmErrorResult<Class>
luaR_newclass
Source§unsafe fn inherit_class(
&self,
child: Class,
parent: Class,
) -> VmErrorResult<Class>
unsafe fn inherit_class( &self, child: Class, parent: Class, ) -> VmErrorResult<Class>
luaR_inheritclass
Source§unsafe fn free_class(&self, class: Class, page: LuaPage)
unsafe fn free_class(&self, class: Class, page: LuaPage)
luaR_freeclass
Source§unsafe fn free_object(&self, object: Object, page: LuaPage)
unsafe fn free_object(&self, object: Object, page: LuaPage)
luaR_freeobject
Source§unsafe fn create_object(&self) -> NativeCallResult
unsafe fn create_object(&self) -> NativeCallResult
luaR_createobject
Source§impl DebugRuntime for Thread
impl DebugRuntime for Thread
Source§unsafe fn type_error<T>(
&self,
object: TValue,
operation: &str,
) -> VmErrorResult<T>
unsafe fn type_error<T>( &self, object: TValue, operation: &str, ) -> VmErrorResult<T>
luaG_typeerror
Source§unsafe fn concat_error<T>(
&self,
left: TValue,
right: TValue,
) -> VmErrorResult<T>
unsafe fn concat_error<T>( &self, left: TValue, right: TValue, ) -> VmErrorResult<T>
luaG_concaterror
Source§unsafe fn arith_error<T>(
&self,
left: TValue,
right: TValue,
operation: TmEvent,
) -> VmErrorResult<T>
unsafe fn arith_error<T>( &self, left: TValue, right: TValue, operation: TmEvent, ) -> VmErrorResult<T>
luaG_aritherror
Source§unsafe fn order_error<T>(
&self,
left: TValue,
right: TValue,
operation: TmEvent,
) -> VmErrorResult<T>
unsafe fn order_error<T>( &self, left: TValue, right: TValue, operation: TmEvent, ) -> VmErrorResult<T>
luaG_ordererror
Source§unsafe fn index_error<T>(&self, object: TValue, key: TValue) -> VmErrorResult<T>
unsafe fn index_error<T>(&self, object: TValue, key: TValue) -> VmErrorResult<T>
luaG_indexerror
Source§unsafe fn method_error<T>(
&self,
object: TValue,
key: TString,
) -> VmErrorResult<T>
unsafe fn method_error<T>( &self, object: TValue, key: TString, ) -> VmErrorResult<T>
luaG_methoderror
Source§unsafe fn missing_member_error<T>(
&self,
object: TValue,
key: TValue,
) -> VmErrorResult<T>
unsafe fn missing_member_error<T>( &self, object: TValue, key: TValue, ) -> VmErrorResult<T>
luaG_missingmembererror
Source§unsafe fn readonly_error<T>(&self) -> VmErrorResult<T>
unsafe fn readonly_error<T>(&self) -> VmErrorResult<T>
luaG_readonlyerror
Source§unsafe fn run_error<'a, T, F, A>(&self, format: F, args: A) -> VmErrorResult<T>
unsafe fn run_error<'a, T, F, A>(&self, format: F, args: A) -> VmErrorResult<T>
luaG_runerror
Source§unsafe fn push_error(&self, error: &BStr) -> VmErrorResult
unsafe fn push_error(&self, error: &BStr) -> VmErrorResult
luaG_pusherror
Source§unsafe fn breakpoint_internal(
&self,
proto: Proto,
line: i32,
enable: bool,
) -> VmErrorResult
unsafe fn breakpoint_internal( &self, proto: Proto, line: i32, enable: bool, ) -> VmErrorResult
luaG_breakpoint
Source§unsafe fn has_native(&self, level: i32) -> i32
unsafe fn has_native(&self, level: i32) -> i32
luaG_hasnative
impl Eq for Thread
Source§impl ErrorRuntime for Thread
impl ErrorRuntime for Thread
Source§unsafe fn set_error_object(&self, error_code: i32, old_top: TValueCursor)
unsafe fn set_error_object(&self, error_code: i32, old_top: TValueCursor)
luaD_seterrorobj
Source§impl FunctionRuntime for Thread
impl FunctionRuntime for Thread
Source§unsafe fn find_upvalue(&self, level: TValue) -> VmErrorResult<UpVal>
unsafe fn find_upvalue(&self, level: TValue) -> VmErrorResult<UpVal>
luaF_findupval
Source§unsafe fn close_upvalue(&self, upvalue: UpVal, dead: bool)
unsafe fn close_upvalue(&self, upvalue: UpVal, dead: bool)
luaF_closeupval
Source§unsafe fn new_proto(&self) -> VmErrorResult<Proto>
unsafe fn new_proto(&self) -> VmErrorResult<Proto>
luaF_newproto
Source§unsafe fn new_lua_closure(
&self,
element_count: i32,
environment: Option<Table>,
proto: Proto,
) -> VmErrorResult<Closure>
unsafe fn new_lua_closure( &self, element_count: i32, environment: Option<Table>, proto: Proto, ) -> VmErrorResult<Closure>
luaF_newLclosure
Source§unsafe fn new_native_closure(
&self,
element_count: i32,
environment: Option<Table>,
) -> VmErrorResult<Closure>
unsafe fn new_native_closure( &self, element_count: i32, environment: Option<Table>, ) -> VmErrorResult<Closure>
luaF_newCclosure
Source§unsafe fn free_proto(&self, proto: Proto, page: LuaPage)
unsafe fn free_proto(&self, proto: Proto, page: LuaPage)
luaF_freeproto
Source§unsafe fn free_closure(&self, closure: Closure, page: LuaPage)
unsafe fn free_closure(&self, closure: Closure, page: LuaPage)
luaF_freeclosure
Source§unsafe fn free_upvalue(&self, upvalue: UpVal, page: LuaPage)
unsafe fn free_upvalue(&self, upvalue: UpVal, page: LuaPage)
luaF_freeupval
Source§impl GcBarrier for Thread
impl GcBarrier for Thread
Source§unsafe fn barrier_value(&self, object: GcObject, value: TValue)
unsafe fn barrier_value(&self, object: GcObject, value: TValue)
luaC_barrier
Source§unsafe fn object_barrier(&self, object: GcObject, child: GcObject)
unsafe fn object_barrier(&self, object: GcObject, child: GcObject)
luaC_objbarrier
Source§unsafe fn thread_barrier(&self)
unsafe fn thread_barrier(&self)
luaC_threadbarrier
Source§unsafe fn barrier_forward(&self, object: GcObject, value: GcObject)
unsafe fn barrier_forward(&self, object: GcObject, value: GcObject)
luaC_barrierf
Source§unsafe fn barrier_table(&self, table: Table, value: GcObject)
unsafe fn barrier_table(&self, table: Table, value: GcObject)
luaC_barriertable
Source§unsafe fn barrier_back(&self, object: GcObject, gc_list: *mut *mut RawGcObject)
unsafe fn barrier_back(&self, object: GcObject, gc_list: *mut *mut RawGcObject)
luaC_barrierback
Source§unsafe fn upvalue_closed(&self, upvalue: UpVal)
unsafe fn upvalue_closed(&self, upvalue: UpVal)
luaC_upvalclosed
Source§impl GcRuntime for Thread
impl GcRuntime for Thread
Source§unsafe fn check_gc(&self) -> VmErrorResult
unsafe fn check_gc(&self) -> VmErrorResult
luaC_checkGC
Source§unsafe fn dump(
&self,
file: *mut (),
category_name: Option<&mut dyn GcCategoryNamer>,
)
unsafe fn dump( &self, file: *mut (), category_name: Option<&mut dyn GcCategoryNamer>, )
luaC_dump
Source§unsafe fn enum_heap(&self, context: *mut (), node: GcHeapNode, edge: GcHeapEdge)
unsafe fn enum_heap(&self, context: *mut (), node: GcHeapNode, edge: GcHeapEdge)
luaC_enumheap
Source§unsafe fn allocation_rate(&self) -> i64
unsafe fn allocation_rate(&self) -> i64
luaC_allocationrate
Source§impl MemoryRuntime for Thread
impl MemoryRuntime for Thread
Source§unsafe fn free_gco(
&self,
block: GcObject,
old_size: usize,
memcat: u8,
page: LuaPage,
)
unsafe fn free_gco( &self, block: GcObject, old_size: usize, memcat: u8, page: LuaPage, )
luaM_freegco_
Source§unsafe fn realloc_raw(
&self,
block: *mut u8,
old_layout: Layout,
new_layout: Layout,
memcat: u8,
) -> VmErrorResult<*mut u8>
unsafe fn realloc_raw( &self, block: *mut u8, old_layout: Layout, new_layout: Layout, memcat: u8, ) -> VmErrorResult<*mut u8>
luaM_realloc_
Source§unsafe fn too_big<T>(&self) -> VmErrorResult<T>
unsafe fn too_big<T>(&self) -> VmErrorResult<T>
luaM_toobig
Source§unsafe fn visit_gco(
&self,
context: *mut (),
visitor: unsafe fn(*mut (), LuaPage, GcObject) -> bool,
)
unsafe fn visit_gco( &self, context: *mut (), visitor: unsafe fn(*mut (), LuaPage, GcObject) -> bool, )
luaM_visitgco
unsafe fn new_array<T>(&self, count: usize, memcat: u8) -> VmErrorResult<*mut T>
unsafe fn free_array<T>(&self, block: *mut T, count: usize, memcat: u8)
unsafe fn realloc_array<T>( &self, block: *mut T, old_count: usize, new_count: usize, memcat: u8, ) -> VmErrorResult<*mut T>
unsafe fn array_layout<T>(&self, count: usize) -> VmErrorResult<Layout>
Source§impl MetamethodRuntime for Thread
impl MetamethodRuntime for Thread
Source§unsafe fn init(&self) -> VmErrorResult
unsafe fn init(&self) -> VmErrorResult
luaT_init
Source§unsafe fn get_tm_by_obj(&self, object: TValue, event: TmEvent) -> Option<TValue>
unsafe fn get_tm_by_obj(&self, object: TValue, event: TmEvent) -> Option<TValue>
luaT_gettmbyobj
Source§unsafe fn obj_type_name_str(&self, object: TValue) -> TString
unsafe fn obj_type_name_str(&self, object: TValue) -> TString
luaT_objtypenamestr
Source§unsafe fn obj_type_name(&self, object: TValue) -> LuaString
unsafe fn obj_type_name(&self, object: TValue) -> LuaString
luaT_objtypename
Source§impl ProtectedCall for Thread
impl ProtectedCall for Thread
Source§impl RawHandle for Thread
impl RawHandle for Thread
Source§type Raw = RawLuaState
type Raw = RawLuaState
Source§fn as_ptr(&self) -> *mut RawLuaState
fn as_ptr(&self) -> *mut RawLuaState
Source§impl RawStackAccess for Thread
impl RawStackAccess for Thread
Source§unsafe fn push_value_internal(&self, value: TValue) -> VmErrorResult
unsafe fn push_value_internal(&self, value: TValue) -> VmErrorResult
luaA_pushvalue
Source§unsafe fn push_class(&self, class: Class) -> VmErrorResult
unsafe fn push_class(&self, class: Class) -> VmErrorResult
luaA_pushclass
unsafe fn push_table(&self, table: Table) -> VmErrorResult
Source§impl StringFormatting for Thread
impl StringFormatting for Thread
Source§unsafe fn push_vfstring_internal<'a, A>(
&self,
format: &str,
args: A,
) -> VmErrorResult<LuaString>
unsafe fn push_vfstring_internal<'a, A>( &self, format: &str, args: A, ) -> VmErrorResult<LuaString>
luaO_pushvfstring
Source§unsafe fn push_fstring_internal<'a, A>(
&self,
format: &str,
args: A,
) -> VmErrorResult<LuaString>
unsafe fn push_fstring_internal<'a, A>( &self, format: &str, args: A, ) -> VmErrorResult<LuaString>
luaO_pushfstringSource§impl StringRuntime for Thread
impl StringRuntime for Thread
Source§unsafe fn resize(&self, new_size: i32) -> VmErrorResult
unsafe fn resize(&self, new_size: i32) -> VmErrorResult
luaS_resize
Source§unsafe fn intern_string(&self, bytes: &BStr) -> VmErrorResult<TString>
unsafe fn intern_string(&self, bytes: &BStr) -> VmErrorResult<TString>
luaS_newlstr
Source§unsafe fn free_string(&self, string: TString, page: LuaPage)
unsafe fn free_string(&self, string: TString, page: LuaPage)
luaS_free
Source§unsafe fn update_atom(&self, string: TString)
unsafe fn update_atom(&self, string: TString)
luaS_updateatom
Source§unsafe fn buffer_start(&self, size: usize) -> VmErrorResult<TString>
unsafe fn buffer_start(&self, size: usize) -> VmErrorResult<TString>
luaS_bufstart
Source§unsafe fn buffer_finish(&self, string: TString) -> VmErrorResult<TString>
unsafe fn buffer_finish(&self, string: TString) -> VmErrorResult<TString>
luaS_buffinish
impl StructuralPartialEq for Thread
Source§impl TableRuntime for Thread
impl TableRuntime for Thread
Source§unsafe fn set_str(
&self,
table: Table,
key: TString,
) -> VmErrorResult<LuaNodeCursor>
unsafe fn set_str( &self, table: Table, key: TString, ) -> VmErrorResult<LuaNodeCursor>
luaH_setstr
Source§unsafe fn setp(
&self,
table: Table,
key: *mut (),
tag: i32,
) -> VmErrorResult<TValue>
unsafe fn setp( &self, table: Table, key: *mut (), tag: i32, ) -> VmErrorResult<TValue>
luaH_setp
Source§unsafe fn set_slot(
&self,
table: Table,
slot: TValue,
key: TValue,
) -> VmErrorResult<TValue>
unsafe fn set_slot( &self, table: Table, slot: TValue, key: TValue, ) -> VmErrorResult<TValue>
luaH_setslot
Source§unsafe fn next_internal(
&self,
table: Table,
key: TValueCursor,
) -> VmErrorResult<i32>
unsafe fn next_internal( &self, table: Table, key: TValueCursor, ) -> VmErrorResult<i32>
luaH_next
Source§unsafe fn new_table_internal(
&self,
n_array: i32,
n_hash: i32,
) -> VmErrorResult<Table>
unsafe fn new_table_internal( &self, n_array: i32, n_hash: i32, ) -> VmErrorResult<Table>
luaH_new
Source§unsafe fn resize_array(&self, table: Table, n_array: i32) -> VmErrorResult
unsafe fn resize_array(&self, table: Table, n_array: i32) -> VmErrorResult
luaH_resizearray
Source§unsafe fn resize_hash(&self, table: Table, n_hash: i32) -> VmErrorResult
unsafe fn resize_hash(&self, table: Table, n_hash: i32) -> VmErrorResult
luaH_resizehash
Source§unsafe fn free_table(&self, table: Table, page: LuaPage)
unsafe fn free_table(&self, table: Table, page: LuaPage)
luaH_free
Source§unsafe fn clone_table_internal(&self, table: Table) -> VmErrorResult<Table>
unsafe fn clone_table_internal(&self, table: Table) -> VmErrorResult<Table>
luaH_clone
Source§impl ThreadLifecycle for Thread
impl ThreadLifecycle for Thread
Source§unsafe fn new_thread_internal(&self) -> VmErrorResult<Thread>
unsafe fn new_thread_internal(&self) -> VmErrorResult<Thread>
luaE_newthread
Source§unsafe fn free_thread(&self, thread: &Thread, page: LuaPage)
unsafe fn free_thread(&self, thread: &Thread, page: LuaPage)
luaE_freethread
Source§unsafe fn allocation_size(&self) -> usize
unsafe fn allocation_size(&self) -> usize
Source§impl ThreadStack for Thread
impl ThreadStack for Thread
Source§unsafe fn check_stack_internal(&self, needed: i32) -> VmErrorResult
unsafe fn check_stack_internal(&self, needed: i32) -> VmErrorResult
luaD_checkstack
Source§unsafe fn check_stack_for_new_ci(&self, needed: i32) -> VmErrorResult
unsafe fn check_stack_for_new_ci(&self, needed: i32) -> VmErrorResult
luaD_checkstackfornewci
Source§unsafe fn get_grown_stack_size(&self, needed: i32) -> i32
unsafe fn get_grown_stack_size(&self, needed: i32) -> i32
getgrownstacksize
Source§unsafe fn stack_limit_reached(&self, needed: i32) -> bool
unsafe fn stack_limit_reached(&self, needed: i32) -> bool
stacklimitreached
Source§unsafe fn save_stack(&self, pointer: TValueCursor) -> isize
unsafe fn save_stack(&self, pointer: TValueCursor) -> isize
savestack
Source§unsafe fn restore_stack(&self, offset: isize) -> TValueCursor
unsafe fn restore_stack(&self, offset: isize) -> TValueCursor
restorestack
Source§unsafe fn save_ci(&self, pointer: CallInfoCursor) -> isize
unsafe fn save_ci(&self, pointer: CallInfoCursor) -> isize
saveci
Source§unsafe fn restore_ci(&self, offset: isize) -> CallInfoCursor
unsafe fn restore_ci(&self, offset: isize) -> CallInfoCursor
restoreci
Source§unsafe fn expand_stack_limit(&self, pointer: TValueCursor)
unsafe fn expand_stack_limit(&self, pointer: TValueCursor)
expandstacklimit
Source§unsafe fn realloc_stack(&self, new_size: i32, for_new_ci: bool) -> VmErrorResult
unsafe fn realloc_stack(&self, new_size: i32, for_new_ci: bool) -> VmErrorResult
luaD_reallocstack
Source§unsafe fn realloc_ci(&self, new_size: i32) -> VmErrorResult
unsafe fn realloc_ci(&self, new_size: i32) -> VmErrorResult
luaD_reallocCI
Source§unsafe fn grow_stack(&self, needed: i32) -> VmErrorResult
unsafe fn grow_stack(&self, needed: i32) -> VmErrorResult
luaD_growstack
Source§unsafe fn grow_ci(&self) -> VmErrorResult<CallInfoCursor>
unsafe fn grow_ci(&self) -> VmErrorResult<CallInfoCursor>
luaD_growCI
Source§unsafe fn incr_ci(&self) -> VmErrorResult<CallInfoCursor>
unsafe fn incr_ci(&self) -> VmErrorResult<CallInfoCursor>
incr_ci
Source§unsafe fn check_c_stack(&self) -> VmErrorResult
unsafe fn check_c_stack(&self) -> VmErrorResult
luaD_checkCstack
Source§impl ThreadState for Thread
impl ThreadState for Thread
unsafe fn from_raw(raw: NonNull<RawLuaState>) -> Self
unsafe fn current_call_info_cursor(&self) -> CallInfoCursor
unsafe fn base_call_info_cursor(&self) -> CallInfoCursor
unsafe fn set_current_call_info(&self, call_info: CallInfoCursor)
unsafe fn stack(&self) -> TValueCursor
unsafe fn stack_base(&self) -> TValueCursor
unsafe fn stack_top(&self) -> TValueCursor
unsafe fn stack_last(&self) -> TValueCursor
unsafe fn set_stack(&self, stack: TValueCursor)
unsafe fn set_stack_base(&self, base: TValueCursor)
unsafe fn set_stack_top(&self, top: TValueCursor)
unsafe fn open_upvalue(&self) -> Option<UpVal>
unsafe fn set_open_upvalue(&self, upvalue: Option<UpVal>)
unsafe fn gc_list(&self) -> Option<GcObject>
unsafe fn set_gc_list(&self, gc_list: Option<GcObject>)
unsafe fn name_call(&self) -> Option<TString>
unsafe fn set_name_call(&self, name_call: Option<TString>)
unsafe fn cached_slot(&self) -> i32
unsafe fn set_cached_slot(&self, cached_slot: i32)
unsafe fn globals(&self) -> Table
unsafe fn set_globals(&self, globals: Table)
unsafe fn increment_native_call_depth(&self)
unsafe fn decrement_native_call_depth(&self)
unsafe fn increment_base_native_call_depth(&self)
unsafe fn decrement_base_native_call_depth(&self)
unsafe fn current_call_info(&self) -> CallInfo
unsafe fn base_call_info(&self) -> CallInfo
unsafe fn restore_call_frame( &self, call_info: CallInfoCursor, top: TValueCursor, )
unsafe fn current_function(&self) -> Closure
unsafe fn current_env(&self) -> Table
Source§impl TypedUserdataAccess for Thread
impl TypedUserdataAccess for Thread
unsafe fn typed_userdata(&self, userdata: Userdata) -> Option<TypedUserdata>
unsafe fn typed_userdata_at(&self, index: i32) -> Option<TypedUserdata>
unsafe fn push_typed_userdata<T: 'static>( &self, value: T, registration: &UserdataTypeRegistration, ) -> VmErrorResult
unsafe fn typed_userdata_value(&self, userdata: TypedUserdata) -> TValue
unsafe fn set_typed_userdata_value( &self, userdata: TypedUserdata, value: TValue, )
unsafe fn take_typed_userdata<T: 'static>( &self, userdata: TypedUserdata, ) -> Result<T, TypedUserdataError>
unsafe fn destroy_typed_userdata( &self, userdata: TypedUserdata, ) -> Result<(), TypedUserdataError>
Source§impl UserdataRuntime for Thread
impl UserdataRuntime for Thread
Source§unsafe fn new_userdata_internal(
&self,
payload_len: usize,
tag: i32,
) -> VmErrorResult<Userdata>
unsafe fn new_userdata_internal( &self, payload_len: usize, tag: i32, ) -> VmErrorResult<Userdata>
luaU_newudata
Source§unsafe fn free_userdata(&self, userdata: Userdata, page: LuaPage)
unsafe fn free_userdata(&self, userdata: Userdata, page: LuaPage)
luaU_freeudata
unsafe fn new_userdata_tagged_internal( &self, size: usize, tag: i32, ) -> VmErrorResult<*mut ()>
Source§impl UserdataTypeRegistryAccess for Thread
impl UserdataTypeRegistryAccess for Thread
unsafe fn userdata_type<T: 'static>(&self) -> Option<UserdataTypeRegistration>
unsafe fn retire_userdata_type<T: 'static>(&self)
unsafe fn register_userdata_type<T: 'static>( &self, metatable_index: i32, ) -> VmErrorResult<UserdataTypeRegistration>
Source§impl VmCallFrame for Thread
impl VmCallFrame for Thread
Source§unsafe fn try_func_tm(&self, function: TValueCursor) -> VmResult
unsafe fn try_func_tm(&self, function: TValueCursor) -> VmResult
luaV_tryfuncTM
Source§unsafe fn pre_call(
&self,
function: TValueCursor,
n_results: i32,
) -> VmResult<PreCallResult>
unsafe fn pre_call( &self, function: TValueCursor, n_results: i32, ) -> VmResult<PreCallResult>
luau_precall
Source§unsafe fn pos_call(&self, first: TValueCursor)
unsafe fn pos_call(&self, first: TValueCursor)
luau_poscall
Source§impl VmConversions for Thread
impl VmConversions for Thread
Source§unsafe fn to_number_internal(
&self,
value: TValue,
result: TValue,
) -> Option<TValue>
unsafe fn to_number_internal( &self, value: TValue, result: TValue, ) -> Option<TValue>
luaV_tonumber
Source§unsafe fn to_string_internal(&self, value: TValue) -> VmErrorResult<i32>
unsafe fn to_string_internal(&self, value: TValue) -> VmErrorResult<i32>
luaV_tostring
Source§impl VmExecution for Thread
impl VmExecution for Thread
Source§impl VmOperations for Thread
impl VmOperations for Thread
Source§unsafe fn less_than_internal(
&self,
left: TValue,
right: TValue,
) -> VmResult<i32>
unsafe fn less_than_internal( &self, left: TValue, right: TValue, ) -> VmResult<i32>
luaV_lessthan
Source§unsafe fn do_arith_impl(
&self,
result: TValueCursor,
left: TValue,
right: TValue,
op: TmEvent,
) -> VmResult
unsafe fn do_arith_impl( &self, result: TValueCursor, left: TValue, right: TValue, op: TmEvent, ) -> VmResult
luaV_doarithimpl
Source§unsafe fn get_table_internal(
&self,
table: TValue,
key: TValue,
value: TValueCursor,
) -> VmResult
unsafe fn get_table_internal( &self, table: TValue, key: TValue, value: TValueCursor, ) -> VmResult
luaV_gettable
Source§unsafe fn set_table_internal(
&self,
table: TValue,
key: TValue,
value: TValue,
) -> VmResult
unsafe fn set_table_internal( &self, table: TValue, key: TValue, value: TValue, ) -> VmResult
luaV_settable
Source§unsafe fn get_import(
&self,
env: Table,
constants: TValueCursor,
target: TValueCursor,
id: u32,
propagate_nil: bool,
) -> VmResult
unsafe fn get_import( &self, env: Table, constants: TValueCursor, target: TValueCursor, id: u32, propagate_nil: bool, ) -> VmResult
luaV_getimport
Source§unsafe fn prepare_forn(
&self,
limit: TValueCursor,
step: TValueCursor,
index: TValueCursor,
) -> VmResult
unsafe fn prepare_forn( &self, limit: TValueCursor, step: TValueCursor, index: TValueCursor, ) -> VmResult
luaV_prepareFORN