luau 0.732.0

Safe lifetime-bound Rust embedding API for the Luau runtime
docs.rs failed to build luau-0.732.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.

luau-rs

luau-rs is a Rust implementation of Luau, including the parser, bytecode compiler, bytecode model, virtual machine, standard libraries, configuration loading, and command-line tools.

[!CAUTION] luau-rs is highly experimental. It is not ready for production use, compatibility is incomplete, and public APIs may change without notice. For production use, choose the official Luau implementation or, for Rust applications, mlua with its luau feature.

The initial release covers the parser, bytecode compiler, VM, standard libraries, command-line tools, and synchronous embedding API. Native code generation, type analysis, and async embedding remain in development.

Why This Exists

Unlike a binding that puts a Rust API around the C++ runtime, luau-rs ports the implementation itself. Ownership, rooting, allocation, and unsafe boundaries are therefore visible in one Rust codebase, where they can be tested, fuzzed, and progressively tightened instead of ending at an FFI boundary.

Luau remains the source of truth for language and runtime behavior. The goal is not a new dialect or an independently evolving VM, but a source-faithful port with a safe embedding layer built on the same internal invariants.

Development Disclosure

All code in this repository was written by AI with human direction and review throughout. The project is developed through a deep, iterative human–AI loop in which scope, design constraints, source evidence, verification, and every accepted change are reviewed by a human.

Install

Rust 1.88 or newer is required.

Install the command-line tools from crates.io:

cargo install luau-cli

Command-Line Usage

Run a Luau script:

luau script.luau

Compile source to bytecode:

luau-compile --binary script.luau > script.luauc

Library Usage

Add the crate to a Rust project:

[dependencies]
luau = "0.732"

Compile and execute source through the safe embedding API:

let lua = luau::Lua::new().expect("failed to create Luau state");
let answer: i32 = lua
    .load("return 40 + 2")
    .set_name("example")
    .call(())
    .expect("script failed");
assert_eq!(answer, 42);

See the API documentation and runnable examples for the rest of the embedding API. Lower-level parser, compiler, bytecode, and VM crates are available separately for applications that need those boundaries directly.

Contributing

See CONTRIBUTING.md before opening an issue or pull request. Report vulnerabilities as described in SECURITY.md.

License

luau-rs is licensed under the MIT License. The Unicode-derived confusables data in luau-syntax is also distributed under the Unicode data-file license.