aboutsummaryrefslogtreecommitdiff
path: root/lvm.c
diff options
context:
space:
mode:
Diffstat (limited to 'lvm.c')
-rw-r--r--lvm.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/lvm.c b/lvm.c
index 051b948c..27ade135 100644
--- a/lvm.c
+++ b/lvm.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lvm.c,v 2.257 2015/10/28 14:50:09 roberto Exp roberto $ 2** $Id: lvm.c,v 2.258 2015/11/02 11:43:17 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*/
@@ -1274,23 +1274,21 @@ void luaV_execute (lua_State *L) {
1274 vmbreak; 1274 vmbreak;
1275 } 1275 }
1276 vmcase(OP_VARARG) { 1276 vmcase(OP_VARARG) {
1277 int b = GETARG_B(i) - 1; 1277 int b = GETARG_B(i) - 1; /* required results */
1278 int j; 1278 int j;
1279 int n = cast_int(base - ci->func) - cl->p->numparams - 1; 1279 int n = cast_int(base - ci->func) - cl->p->numparams - 1;
1280 if (n < 0) /* less arguments than parameters? */
1281 n = 0; /* no vararg arguments */
1280 if (b < 0) { /* B == 0? */ 1282 if (b < 0) { /* B == 0? */
1281 b = n; /* get all var. arguments */ 1283 b = n; /* get all var. arguments */
1282 Protect(luaD_checkstack(L, n)); 1284 Protect(luaD_checkstack(L, n));
1283 ra = RA(i); /* previous call may change the stack */ 1285 ra = RA(i); /* previous call may change the stack */
1284 L->top = ra + n; 1286 L->top = ra + n;
1285 } 1287 }
1286 for (j = 0; j < b; j++) { 1288 for (j = 0; j < b && j < n; j++)
1287 if (j < n) { 1289 setobjs2s(L, ra + j, base - n + j);
1288 setobjs2s(L, ra + j, base - n + j); 1290 for (; j < b; j++) /* complete required results with nil */
1289 } 1291 setnilvalue(ra + j);
1290 else {
1291 setnilvalue(ra + j);
1292 }
1293 }
1294 vmbreak; 1292 vmbreak;
1295 } 1293 }
1296 vmcase(OP_EXTRAARG) { 1294 vmcase(OP_EXTRAARG) {