rhai/examples/hello.rs
2022-02-10 12:54:30 +08:00

14 lines
278 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!("The Answer: {}", result); // prints 42
Ok(())
}