summaryrefslogtreecommitdiff
path: root/Build/source/libs/lua53/lua53-src/src/ldebug.c
diff options
context:
space:
mode:
authorLuigi Scarso <luigi.scarso@gmail.com>2020-10-04 19:39:39 +0000
committerLuigi Scarso <luigi.scarso@gmail.com>2020-10-04 19:39:39 +0000
commit897efa4b7afe155a5913e31e318891bba54dd1bb (patch)
treec696b26e7512932f476d9fde7536194a585457cf /Build/source/libs/lua53/lua53-src/src/ldebug.c
parentb485704ecdb46ae6bc0997142320038f924469d1 (diff)
sync with upstream luatex; Lua 5.3.6
git-svn-id: svn://tug.org/texlive/trunk@56535 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/lua53/lua53-src/src/ldebug.c')
-rw-r--r--Build/source/libs/lua53/lua53-src/src/ldebug.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Build/source/libs/lua53/lua53-src/src/ldebug.c b/Build/source/libs/lua53/lua53-src/src/ldebug.c
index e1389296e9e..bb0e1d4aced 100644
--- a/Build/source/libs/lua53/lua53-src/src/ldebug.c
+++ b/Build/source/libs/lua53/lua53-src/src/ldebug.c
@@ -133,10 +133,11 @@ static const char *upvalname (Proto *p, int uv) {
static const char *findvararg (CallInfo *ci, int n, StkId *pos) {
int nparams = clLvalue(ci->func)->p->numparams;
- if (n >= cast_int(ci->u.l.base - ci->func) - nparams)
+ int nvararg = cast_int(ci->u.l.base - ci->func) - nparams;
+ if (n <= -nvararg)
return NULL; /* no such vararg */
else {
- *pos = ci->func + nparams + n;
+ *pos = ci->func + nparams - n;
return "(*vararg)"; /* generic name for any vararg */
}
}
@@ -148,7 +149,7 @@ static const char *findlocal (lua_State *L, CallInfo *ci, int n,
StkId base;
if (isLua(ci)) {
if (n < 0) /* access to vararg values? */
- return findvararg(ci, -n, pos);
+ return findvararg(ci, n, pos);
else {
base = ci->u.l.base;
name = luaF_getlocalname(ci_func(ci)->p, n, currentpc(ci));