rustia 0.2.0

Rustia is a pure-Rust interpreter for embedding standalone Luau in games and tools. Edit scripts without a rebuild and let players write mods. Rustia grew out of a game by Slowchop Studios that needed to script character decisions and replay them on desktop and in a browser.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//! A Luau function tries to read a missing target. Print `error.report()` to
//! show the source line and the calls that led to it.

use rustia::{Result, RustiaBuilder};

fn main() -> Result<()> {
    let mut rustia = RustiaBuilder::standard().build()?;
    let result = rustia
        .load("local function attack(target)\n    return target.health\nend\nlocal function take_turn()\n    return attack(nil)\nend\ntake_turn()")
        .source_name("combat.luau")
        .exec();
    if let Err(error) = result {
        eprintln!("{}", error.report());
    }
    Ok(())
}