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 intuitively:
if status is Complete(value) then
print("done(" .. value .. ")")
end
Embedding in C (WIP)
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.
Things considered more in the stable territory:
- std interpreter
- std JIT (Optimizations are rare, error cases are rare under normal use)
- no_std interpreter
Other things WIP:
- tree-sitter (Missing a few highlight scenarios)
- vsc-extension (Haven't touched this in a while)
- lust-analyzer (Still useful, but missing a lot of useful errors)
- Package system
The language is still heavily WIP in general, absolute stability is not guaranteed.
License
License for the language/interpreter is currently PolyForm Noncommercial License 1.0.0. Once I am comfortable with the state of the language core it will be moved to MIT/GPLv3 (Undecided).