I write a lot of Luau and a lot of Rust, and wanted the first one inside the second, so here we are. Rhue looks like Luau (same syntax, same --!strict gradual typing), embeds about as easily as Rhai, and runs on its own register VM. This is the crate you want, the rest are its insides.
[]
= "1"
use Engine;
let mut engine = new;
engine.register;
let out: String = engine.eval_as.unwrap;
assert_eq!;
What you get:
- Typed
register— parameters and results convert on their own, and the type checker learns each function's signature from its Rust types #[derive(UserData)]— Rust structs as script objects, with methods and a constructor- Calling back — take
&mut Contextfirst and a native can call script functions, errors pass through?unchanged - Sandboxing — instruction and memory limits, separate environments so plugins can't see each other's globals, a sandbox-safe
os - Modules —
requirefrom source, a loader, or compiled bytecode, with types that travel with them - Tasks — natives that pause a script until the host resumes it, and Roblox's
tasklibrary on a clock you drive - Async — async Rust functions scripts can wait on,
eval_async, and interrupts from any thread - Hot reload — swap a module for new code while scripts run, state carries over
- Debug hooks — line, call and return events, locals, upvalues, evaluating in a frame
serde— behind theserdefeature, convert anySerialize/Deserializetype to script values and back
use Engine;
let mut engine = new;
engine.set_instruction_limit;
engine.set_memory_limit;
let err = engine.eval.unwrap_err;
assert!;
The repo's README has the full tour of the language, the tooling (CLI, language server, debugger) and the benchmarks. The API docs are on docs.rs, and the site's at rhue.dev.
Needs Rust 1.88 or newer.
License
MIT or Apache-2.0, at your option.