Fix call_fn to take &ast instead of ast.

This commit is contained in:
Stephen Chung
2020-03-07 00:29:45 +08:00
parent c917aa0a5a
commit ea82ee81d6
3 changed files with 8 additions and 8 deletions

View File

@@ -146,7 +146,7 @@ let ast = Engine::compile("fn hello(x, y) { x.len() + y }")?;
// Evaluate the function in the AST, passing arguments into the script as a tuple
// (beware, arguments must be of the correct types because Rhai does not have built-in type conversions)
let result: i64 = engine.call_fn("hello", ast, (&mut String::from("abc"), &mut 123_i64))?;
let result: i64 = engine.call_fn("hello", &ast, (&mut String::from("abc"), &mut 123_i64))?;
```
# Values and types