An async scheduler for Luau, using mlua
and built on top of async-executor
.
This crate is runtime-agnostic and is compatible with any async runtime, including Tokio, smol, async-std, and others. However, since many dependencies are shared with smol, depending on it over other runtimes may be preferred.
Example Usage
1. Import dependencies
use ;
use ErrorKind;
use ;
use read_to_string;
use *;
use *;
2. Set up Lua environment
let lua = new;
lua.globals.set?;
lua.globals.set?;
3. Set up scheduler, run threads
let sched = new?;
// We can create multiple lua threads ...
let sleepThread = lua.load;
let fileThread = lua.load;
// ... spawn them both onto the scheduler ...
sched.push_thread_front;
sched.push_thread_front;
// ... and run until they finish
block_on;