Update README.md

This commit is contained in:
Jonathan Turner 2016-03-31 07:06:39 -07:00
parent ef3ea34d13
commit efb7b31487

View File

@ -46,6 +46,21 @@ fn main() {
} }
``` ```
You can also evaluate a script file:
```Rust
extern crate rhai;
use rhai::Engine;
fn main() {
let mut engine = Engine::new();
if let Ok(result) = engine.eval_file::<i32>("hello_world.rhai") {
println!("Answer: {}", result); // prints 42
}
}
```
# Working with functions # Working with functions
Rhai's scripting engine is very lightweight. It gets its ability from the functions in your program. To call these functions, you need to register them with the scripting engine. Rhai's scripting engine is very lightweight. It gets its ability from the functions in your program. To call these functions, you need to register them with the scripting engine.