diff options
Diffstat (limited to 'ltm.c')
-rw-r--r-- | ltm.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltm.c,v 2.60 2018/02/09 15:16:06 roberto Exp roberto $ | 2 | ** $Id: ltm.c,v 2.61 2018/02/15 15:34:29 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 | */ |
@@ -216,12 +216,13 @@ int luaT_callorderiTM (lua_State *L, const TValue *p1, int v2, | |||
216 | } | 216 | } |
217 | 217 | ||
218 | 218 | ||
219 | void luaT_adjustvarargs (lua_State *L, int nfixparams, CallInfo *ci) { | 219 | void luaT_adjustvarargs (lua_State *L, int nfixparams, CallInfo *ci, |
220 | Proto *p) { | ||
220 | int i; | 221 | int i; |
221 | int actual = cast_int(L->top - ci->func) - 1; /* number of arguments */ | 222 | int actual = cast_int(L->top - ci->func) - 1; /* number of arguments */ |
222 | int nextra = actual - nfixparams; /* number of extra arguments */ | 223 | int nextra = actual - nfixparams; /* number of extra arguments */ |
223 | ci->u.l.nextraargs = nextra; | 224 | ci->u.l.nextraargs = nextra; |
224 | checkstackGC(L, nfixparams + 1); | 225 | checkstackGC(L, p->maxstacksize + 1); |
225 | /* copy function to the top of the stack */ | 226 | /* copy function to the top of the stack */ |
226 | setobjs2s(L, L->top++, ci->func); | 227 | setobjs2s(L, L->top++, ci->func); |
227 | /* move fixed parameters to the top of the stack */ | 228 | /* move fixed parameters to the top of the stack */ |
@@ -231,6 +232,7 @@ void luaT_adjustvarargs (lua_State *L, int nfixparams, CallInfo *ci) { | |||
231 | } | 232 | } |
232 | ci->func += actual + 1; | 233 | ci->func += actual + 1; |
233 | ci->top += actual + 1; | 234 | ci->top += actual + 1; |
235 | lua_assert(L->top <= ci->top && ci->top <= L->stack_last); | ||
234 | } | 236 | } |
235 | 237 | ||
236 | 238 | ||