From 167649d9e477352a20642d29c3a07848de017d4a Mon Sep 17 00:00:00 2001 From: Sofia Date: Sun, 15 Mar 2026 18:03:59 +0200 Subject: [PATCH] Make some tweaks --- examples/test.lua | 2 +- src/vm.rs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/test.lua b/examples/test.lua index 61d42c9..6fa487d 100644 --- a/examples/test.lua +++ b/examples/test.lua @@ -8,4 +8,4 @@ function test() return add(10)(15) end -global c = print(test()) \ No newline at end of file +local c = print(test()) \ No newline at end of file diff --git a/src/vm.rs b/src/vm.rs index 0b056bd..131b82d 100644 --- a/src/vm.rs +++ b/src/vm.rs @@ -282,8 +282,10 @@ impl ClosureRunner { } _ => { dbg!(&value); - for i in 0..=(*ret_len - 2) { - self.stack.insert(*func_reg + i, Value::Nil); + if *ret_len > 0 { + for i in 0..=(*ret_len - 2) { + self.stack.insert(*func_reg + i, Value::Nil); + } } } }