aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authorGustav Sörnäs <gustav@sornas.net>2021-01-21 21:56:29 +0100
committerGustav Sörnäs <gustav@sornas.net>2021-01-29 20:44:36 +0100
commit8a6d8b144f45c509602a598f962d872a98226997 (patch)
treec9966ba2b6605accdfce66768935528065232dc4 /src/main.rs
parent28b84aca844222c3dcccc3ef4b32bac6571ea881 (diff)
downloadsylt-8a6d8b144f45c509602a598f962d872a98226997.tar.gz
call external functions without parameters
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index d5cb465..7909eb9 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,6 +1,7 @@
use std::path::{Path, PathBuf};
use tihdy::run_file;
+use tihdy::vm::Value;
struct Args {
file: Option<PathBuf>,
@@ -10,7 +11,7 @@ struct Args {
fn main() {
let args = parse_args();
let file = args.file.unwrap_or_else(|| Path::new("tests/simple.tdy").to_owned());
- if let Err(errs) = run_file(&file, args.print) {
+ if let Err(errs) = run_file(&file, args.print, vec![(String::from("hello"), hello)]) {
for err in errs.iter() {
println!("{}", err);
}
@@ -36,3 +37,8 @@ fn parse_args() -> Args {
};
args
}
+
+pub fn hello(_parameters: &[Value]) -> Value {
+ println!("Hello World!");
+ Value::Nil
+}