luau 0.732.0

Safe lifetime-bound Rust embedding API for the Luau runtime
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use luau::Compiler;

fn main() -> Result<(), luau::CompilerError> {
    let source = "return 'hello from Luau'";
    let compiler = Compiler::new().set_optimization_level(2);
    let bytecode = compiler.compile(source)?;

    println!(
        "compiled {} bytes:\n```\n{}\n```",
        bytecode.len(),
        compiler.dump(source)?
    );

    Ok(())
}