diff options
| -rw-r--r-- | ldo.c | 7 |
1 files changed, 5 insertions, 2 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldo.c,v 2.34 2005/10/06 20:44:22 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 2.35 2005/10/14 16:23:33 roberto Exp roberto $ |
| 3 | ** Stack and Call structure of Lua | 3 | ** Stack and Call structure of Lua |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -276,8 +276,11 @@ int luaD_precall (lua_State *L, StkId func, int nresults) { | |||
| 276 | Proto *p = cl->p; | 276 | Proto *p = cl->p; |
| 277 | luaD_checkstack(L, p->maxstacksize); | 277 | luaD_checkstack(L, p->maxstacksize); |
| 278 | func = restorestack(L, funcr); | 278 | func = restorestack(L, funcr); |
| 279 | if (!p->is_vararg) /* no varargs? */ | 279 | if (!p->is_vararg) { /* no varargs? */ |
| 280 | base = func + 1; | 280 | base = func + 1; |
| 281 | if (L->top > base + p->numparams) | ||
| 282 | L->top = base + p->numparams; | ||
| 283 | } | ||
| 281 | else { /* vararg function */ | 284 | else { /* vararg function */ |
| 282 | int nargs = cast(int, L->top - func) - 1; | 285 | int nargs = cast(int, L->top - func) - 1; |
| 283 | base = adjust_varargs(L, p, nargs); | 286 | base = adjust_varargs(L, p, nargs); |
