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
16
17
18
use luau::Lua;

fn main() -> luau::Result<()> {
    let lua = Lua::new()?;
    let name = String::from("Luau");
    let punctuation = lua.create_table()?;
    punctuation.set("mark", "!")?;

    let greeting: String = lua
        .load(luau::chunk! {
            return "hello, " .. $name .. $punctuation.mark
        })
        .set_name("captured_chunk")
        .call(())?;

    println!("{greeting}");
    Ok(())
}