Lust
lust-lang.dev · Docs · Embeddable, strongly typed Lua-style scripting
Lust is a strongly typed, Lua-inspired scripting language implemented in Rust. It targets embedding scenarios while staying fast with a hybrid collector and a trace-based JIT.
Features
- Strong static type system with ergonomic enum pattern matching via the
ishelper. - High-performance runtime that pairs reference counting with a fallback mark-and-sweep pass for long-lived cycles.
- Trace-based JIT powered by
dynasm-rs, emitting x64 machine code similar in function to LuaJIT. - Friendly embedding surface for Rust and C, including typed value conversions and module loaders.
- Batteries-included tooling: bytecode compiler, VM, CLI runner, and optional WebAssembly build.
Quick Start
Add the crate (renamed for ergonomic imports):
Install the CLI:
Embedding in Rust
use EmbeddedProgram;
If you register native APIs with export metadata (via VM::register_exported_native / VM::record_exported_native, or the embedding helpers like EmbeddedProgram::register_typed_native),
you can write Lust-readable extern stubs to disk from your embedder:
let _ = program.dump_externs_to_dir;
The is helper works the way you expect:
if status is Complete(value) then
print("done(" .. value .. ")")
end
Embedding in C
The crate ships with a C header at include/lust_ffi.h exposing a minimal ABI so native hosts
can compile and call Lust code. Build the shared library with
cargo build --release --lib and link against liblust:
int
A complete example lives in examples/c-ffi.