Add support for character constants
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
extern crate rhai;
|
||||
use rhai::{Engine, FnRegister};
|
||||
|
||||
fn add(x: i32, y: i32) -> i32 {
|
||||
fn add(x: i64, y: i64) -> i64 {
|
||||
x + y
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ fn main() {
|
||||
|
||||
engine.register_fn("add", add);
|
||||
|
||||
if let Ok(result) = engine.eval::<i32>("add(40, 2)") {
|
||||
if let Ok(result) = engine.eval::<i64>("add(40, 2)") {
|
||||
println!("Answer: {}", result); // prints 42
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user