rhai 0.13.0

Embedded scripting for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use rhai::{Engine, EvalAltResult, Scope, INT};

fn main() -> Result<(), Box<EvalAltResult>> {
    let engine = Engine::new();
    let mut scope = Scope::new();

    engine.eval_with_scope::<()>(&mut scope, "let x = 4 + 5")?;

    let result = engine.eval_with_scope::<INT>(&mut scope, "x")?;

    println!("result: {}", result);

    Ok(())
}