Debug information about extra arguments from __call

'debug.getinfo' can return number of extra arguments added to a call by
a chain of __call metavalues. That information is being used to improve
error messages about errors in these extra arguments.
This commit is contained in:
Roberto Ierusalimschy
2024-11-19 14:09:18 -03:00
parent b117bdb344
commit 50c7c915ee
9 changed files with 83 additions and 12 deletions

View File

@@ -352,7 +352,15 @@ static int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar,
break;
}
case 't': {
ar->istailcall = (ci != NULL && (ci->callstatus & CIST_TAIL));
if (ci != NULL) {
ar->istailcall = !!(ci->callstatus & CIST_TAIL);
ar->extraargs =
cast_uchar((ci->callstatus & MAX_CCMT) >> CIST_CCMT);
}
else {
ar->istailcall = 0;
ar->extraargs = 0;
}
break;
}
case 'n': {