aboutsummaryrefslogtreecommitdiff
path: root/ltm.c
diff options
context:
space:
mode:
Diffstat (limited to 'ltm.c')
-rw-r--r--ltm.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/ltm.c b/ltm.c
index d88b636b..be7dc4f0 100644
--- a/ltm.c
+++ b/ltm.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltm.c,v 2.59 2018/02/07 15:18:04 roberto Exp roberto $ 2** $Id: ltm.c,v 2.60 2018/02/09 15:16:06 roberto Exp roberto $
3** Tag methods 3** Tag methods
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -222,10 +222,12 @@ void luaT_adjustvarargs (lua_State *L, int nfixparams, CallInfo *ci) {
222 int nextra = actual - nfixparams; /* number of extra arguments */ 222 int nextra = actual - nfixparams; /* number of extra arguments */
223 ci->u.l.nextraargs = nextra; 223 ci->u.l.nextraargs = nextra;
224 checkstackGC(L, nfixparams + 1); 224 checkstackGC(L, nfixparams + 1);
225 /* copy function and fixed parameters to the top of the stack */ 225 /* copy function to the top of the stack */
226 for (i = 0; i <= nfixparams; i++) { 226 setobjs2s(L, L->top++, ci->func);
227 /* move fixed parameters to the top of the stack */
228 for (i = 1; i <= nfixparams; i++) {
227 setobjs2s(L, L->top++, ci->func + i); 229 setobjs2s(L, L->top++, ci->func + i);
228 setnilvalue(s2v(ci->func + i)); /* erase original copy (for GC) */ 230 setnilvalue(s2v(ci->func + i)); /* erase original parameter (for GC) */
229 } 231 }
230 ci->func += actual + 1; 232 ci->func += actual + 1;
231 ci->top += actual + 1; 233 ci->top += actual + 1;