Register test functions in repl.

This commit is contained in:
Stephen Chung 2022-01-17 21:50:36 +08:00
parent 16c03cc864
commit 58e1094b79

View File

@ -155,6 +155,13 @@ fn main() {
engine.set_module_resolver(resolver); engine.set_module_resolver(resolver);
} }
engine
.register_fn("test", |x: rhai::INT, y: rhai::INT| format!("{} {}", x, y))
.register_fn("test", |x: &mut rhai::INT, y: rhai::INT, z: &str| {
*x += y;
println!("{} {} {}", x, y, z);
});
// Make Engine immutable // Make Engine immutable
let engine = engine; let engine = engine;