| Crates.io | lust-rs |
| lib.rs | lust-rs |
| version | 3.4.11 |
| created_at | 2025-10-29 22:52:44.262815+00 |
| updated_at | 2026-01-17 00:05:57.034579+00 |
| description | A WIP Lua-like scripting language implemented in Rust, designed for embedding and rapid scripting with a strong type system, with trace-based JIT. |
| homepage | https://lust-lang.dev/ |
| repository | |
| max_upload_size | |
| id | 1907477 |
| size | 1,760,568 |
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.
is helper.dynasm-rs, emitting x64 machine code similar in function to LuaJIT.Add the crate (renamed for ergonomic imports):
cargo add lust-rs --rename lust
Install the CLI:
cargo install lust-rs
lust --help
lust pkg add example-package
lust pkg remove example-package
lust pkg login
lust pkg publish
lust pkg logout
use lust::EmbeddedProgram;
fn main() -> lust::Result<()> {
let mut program = EmbeddedProgram::builder()
.module("main", r#"
pub function greet(name: string): string
return "hi, " .. name
end
"#)
.entry_module("main")
.compile()?;
let greeting: String = program.call_typed("main.greet", "Lust")?;
println!("{greeting}");
Ok(())
}
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("externs");
The is helper works the way you expect:
if status is Complete(value) then
print("done(" .. value .. ")")
end
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:
#include "lust_ffi.h"
int main(void) {
EmbeddedBuilder *builder = lust_builder_new();
lust_builder_add_module(builder, "main", "pub function answer(): int\n return 42\nend\n");
lust_builder_set_entry_module(builder, "main");
EmbeddedProgram *program = lust_builder_compile(builder);
LustFfiValue result = {0};
lust_program_call(program, "main.answer", NULL, 0, &result);
/* ... */
}
A complete example lives in examples/c-ffi.