aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main.rs11
-rw-r--r--src/vm.rs2
-rw-r--r--tests/simple.tdy2
3 files changed, 12 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs
index 7909eb9..a97cd43 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -38,7 +38,14 @@ fn parse_args() -> Args {
args
}
-pub fn hello(_parameters: &[Value]) -> Value {
- println!("Hello World!");
+pub fn hello(parameters: &[Value]) -> Value {
+ match parameters {
+ [Value::String(s)] => {
+ println!("{}", s);
+ }
+ _ => {
+ println!("Bad parameters");
+ }
+ }
Value::Nil
}
diff --git a/src/vm.rs b/src/vm.rs
index 053100f..feb5094 100644
--- a/src/vm.rs
+++ b/src/vm.rs
@@ -628,7 +628,7 @@ impl VM {
}
Value::ExternFunction(slot) => {
let extern_func = self.extern_functions[*slot];
- let res = extern_func(&[]);
+ let res = extern_func(&self.stack[new_base+1..]);
self.stack.truncate(new_base);
self.stack.push(res);
}
diff --git a/tests/simple.tdy b/tests/simple.tdy
index 6793088..8b68da1 100644
--- a/tests/simple.tdy
+++ b/tests/simple.tdy
@@ -1 +1,3 @@
hello()
+hello("a")
+hello("a", "b")