From 49bcc0d2f888da5073b21cf406655fec32abe6db Mon Sep 17 00:00:00 2001 From: Ian Farmer Date: Mon, 3 Sep 2007 05:53:55 +0000 Subject: [PATCH] Fix a bug where "base" was not set correctly for metatable operations. --- src/main/java/lua/VM.java | 4 ++++ src/main/java/lua/value/LFunction.java | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/main/java/lua/VM.java b/src/main/java/lua/VM.java index 94cb7782..ad7fdd16 100644 --- a/src/main/java/lua/VM.java +++ b/src/main/java/lua/VM.java @@ -7,6 +7,10 @@ public interface VM { // ================ interfaces for performing calls + /** Prepare the VM stack for a new call with arguments to be pushed + */ + public void newCall(); + /** Push an argument or return value onto the stack */ public void push( LValue value ); diff --git a/src/main/java/lua/value/LFunction.java b/src/main/java/lua/value/LFunction.java index 2ffb5260..eed156bc 100644 --- a/src/main/java/lua/value/LFunction.java +++ b/src/main/java/lua/value/LFunction.java @@ -12,6 +12,7 @@ public class LFunction extends LValue { } public void luaSetTable(VM vm, LValue table, LValue key, LValue val) { + vm.newCall(); vm.push( this ); vm.push( table ); vm.push( key ); @@ -24,6 +25,7 @@ public class LFunction extends LValue { } public void luaGetTable(VM vm, LValue table, LValue key) { + vm.newCall(); vm.push( this ); vm.push( table ); vm.push( key );