rhai/examples/hello.rs
2020-10-07 15:52:24 +08:00

12 lines
232 B
Rust

use rhai::{Engine, EvalAltResult, INT};
fn main() -> Result<(), Box<EvalAltResult>> {
let engine = Engine::new();
let result = engine.eval::<INT>("40 + 2")?;
println!("Answer: {}", result); // prints 42
Ok(())
}