Struct mlua_luau_scheduler::Functions
source · pub struct Functions<'lua> {
pub resume: LuaFunction<'lua>,
pub wrap: LuaFunction<'lua>,
pub spawn: LuaFunction<'lua>,
pub defer: LuaFunction<'lua>,
pub cancel: LuaFunction<'lua>,
pub exit: LuaFunction<'lua>,
}
Expand description
A collection of lua functions that may be called to interact with a Scheduler
.
Note that these may all be implemented using LuaSchedulerExt
, however, this struct
is implemented using internal (non-public) APIs, and generally has better performance.
Fields§
§resume: LuaFunction<'lua>
Implementation of coroutine.resume
that handles async polling properly.
Defers onto the scheduler queue if the thread calls an async function.
wrap: LuaFunction<'lua>
Implementation of coroutine.wrap
that handles async polling properly.
Defers onto the scheduler queue if the thread calls an async function.
spawn: LuaFunction<'lua>
Resumes a function / thread once instantly, and runs until first yield.
Spawns onto the scheduler queue if not completed.
defer: LuaFunction<'lua>
Defers a function / thread onto the scheduler queue.
Does not resume instantly, only adds to the queue.
cancel: LuaFunction<'lua>
Cancels a function / thread, removing it from the queue.
exit: LuaFunction<'lua>
Exits the scheduler, stopping all other threads and closing the scheduler.
Yields the calling thread to ensure that it does not continue.