diff options
Diffstat (limited to 'lvm.c')
-rw-r--r-- | lvm.c | 18 |
1 files changed, 3 insertions, 15 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 2.279 2017/05/10 17:32:19 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.280 2017/05/11 18:57:46 roberto Exp roberto $ |
3 | ** Lua virtual machine | 3 | ** Lua virtual machine |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -1433,20 +1433,8 @@ void luaV_execute (lua_State *L) { | |||
1433 | } | 1433 | } |
1434 | vmcase(OP_VARARG) { | 1434 | vmcase(OP_VARARG) { |
1435 | int b = GETARG_B(i) - 1; /* required results */ | 1435 | int b = GETARG_B(i) - 1; /* required results */ |
1436 | int j; | 1436 | StkId vtab = base + cl->p->numparams - 1; /* vararg table */ |
1437 | int n = cast_int(base - ci->func) - cl->p->numparams - 1; | 1437 | Protect(luaT_getvarargs(L, vtab, ra, b)); |
1438 | if (n < 0) /* less arguments than parameters? */ | ||
1439 | n = 0; /* no vararg arguments */ | ||
1440 | if (b < 0) { /* B == 0? */ | ||
1441 | b = n; /* get all var. arguments */ | ||
1442 | Protect(luaD_checkstack(L, n)); | ||
1443 | ra = RA(i); /* previous call may change the stack */ | ||
1444 | L->top = ra + n; | ||
1445 | } | ||
1446 | for (j = 0; j < b && j < n; j++) | ||
1447 | setobjs2s(L, ra + j, base - n + j); | ||
1448 | for (; j < b; j++) /* complete required results with nil */ | ||
1449 | setnilvalue(ra + j); | ||
1450 | vmbreak; | 1438 | vmbreak; |
1451 | } | 1439 | } |
1452 | vmcase(OP_EXTRAARG) { | 1440 | vmcase(OP_EXTRAARG) { |