aboutsummaryrefslogtreecommitdiff
path: root/ldo.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2017-12-15 11:07:10 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2017-12-15 11:07:10 -0200
commitb3f924bc695ed6ebe2539d365197696e41863a91 (patch)
treebf756351d06bdfc469846e533699c9ce58bc3566 /ldo.c
parente001d5aea693ca1bcf1a4dfd2f900737fc0a8604 (diff)
downloadlua-b3f924bc695ed6ebe2539d365197696e41863a91.tar.gz
lua-b3f924bc695ed6ebe2539d365197696e41863a91.tar.bz2
lua-b3f924bc695ed6ebe2539d365197696e41863a91.zip
'Proto->numparams' does not include vararg parameter
(one less subtraction when calling functions...)
Diffstat (limited to 'ldo.c')
-rw-r--r--ldo.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ldo.c b/ldo.c
index c06d7133..e58efa52 100644
--- a/ldo.c
+++ b/ldo.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldo.c,v 2.179 2017/12/11 12:43:40 roberto Exp roberto $ 2** $Id: ldo.c,v 2.180 2017/12/12 11:57:30 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*/
@@ -415,7 +415,7 @@ void luaD_pretailcall (lua_State *L, CallInfo *ci, StkId func, int n) {
415 for (i = 0; i < n; i++) /* move down function and arguments */ 415 for (i = 0; i < n; i++) /* move down function and arguments */
416 setobjs2s(L, ci->func + i, func + i); 416 setobjs2s(L, ci->func + i, func + i);
417 checkstackp(L, fsize, func); 417 checkstackp(L, fsize, func);
418 for (; i < p->numparams - p->is_vararg; i++) 418 for (; i < p->numparams; i++)
419 setnilvalue(s2v(ci->func + i)); /* complete missing parameters */ 419 setnilvalue(s2v(ci->func + i)); /* complete missing parameters */
420 if (p->is_vararg) { 420 if (p->is_vararg) {
421 L->top -= (func - ci->func); /* move down top */ 421 L->top -= (func - ci->func); /* move down top */
@@ -469,7 +469,7 @@ void luaD_call (lua_State *L, StkId func, int nresults) {
469 int n = cast_int(L->top - func) - 1; /* number of real arguments */ 469 int n = cast_int(L->top - func) - 1; /* number of real arguments */
470 int fsize = p->maxstacksize; /* frame size */ 470 int fsize = p->maxstacksize; /* frame size */
471 checkstackp(L, fsize, func); 471 checkstackp(L, fsize, func);
472 for (; n < p->numparams - p->is_vararg; n++) 472 for (; n < p->numparams; n++)
473 setnilvalue(s2v(L->top++)); /* complete missing arguments */ 473 setnilvalue(s2v(L->top++)); /* complete missing arguments */
474 if (p->is_vararg) 474 if (p->is_vararg)
475 luaT_adjustvarargs(L, p, n); 475 luaT_adjustvarargs(L, p, n);