rhai/examples/hello.rs

14 lines
274 B
Rust

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