From 6a1fdfb6b001dea49dc70503c39b02201713c76a Mon Sep 17 00:00:00 2001 From: James Roseborough Date: Mon, 27 Apr 2009 22:43:45 +0000 Subject: [PATCH] fix varargs processing when followed by function call (test9.lua) --- src/core/org/luaj/vm/LuaState.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/org/luaj/vm/LuaState.java b/src/core/org/luaj/vm/LuaState.java index b43078c8..91567798 100644 --- a/src/core/org/luaj/vm/LuaState.java +++ b/src/core/org/luaj/vm/LuaState.java @@ -555,6 +555,7 @@ public class LuaState extends Lua { // allow debug hooks a chance to operate debugHooks( ci.pc ); if ( hooksenabled ) { + //Print.printState(this, base, top, base+cl.p.maxstacksize, cl, ci.pc); debugBytecodeHooks( ci.pc ); } @@ -941,15 +942,15 @@ public class LuaState extends Lua { n = nvarargs.toJavaInt(); if (b == LuaState.LUA_MULTRET) { b = n; // use entire varargs supplied + luaV_settop_fillabove( base + a + b ); } // copy args up to call stack area checkstack(a+b); for (int j = 0; j < b; j++) - this.stack[base + a + j] = (j < n ? this.stack[base - - n + j - 1] + this.stack[base + a + j] = (j < n ? + this.stack[base - n + j - 1] : LNil.NIL); - luaV_settop_fillabove( base + a + b ); continue; } }