Skip to content

Commit

Permalink
Added istailcall to debug.getinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
MCJack123 committed May 30, 2022
1 parent 94a55cf commit 9458a84
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/lua.h
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ struct lua_Debug {
/* private part */
int i_ci; /* active function */
int instruction; /* (i) current instruction offset */
int istailcall; /* (t) whether the stack entry is a tail call */
};

/* }====================================================================== */
Expand Down
4 changes: 4 additions & 0 deletions src/ldblib.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ static int db_getinfo (lua_State *L) {
lua_pushboolean(L, ar.isvararg);
lua_setfield(L, -2, "isvararg");
}
if (strchr(options, 't')) {
lua_pushboolean(L, ar.istailcall);
lua_setfield(L, -2, "istailcall");
}
if (strchr(options, 'n')) {
settabss(L, "name", ar.name);
settabss(L, "namewhat", ar.namewhat);
Expand Down
4 changes: 4 additions & 0 deletions src/ldebug.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,10 @@ static int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar,
}
break;
}
case 't': {
ar->istailcall = (ci) ? ci->tailcalls > 0 : 0;
break;
}
case 'n': {
ar->namewhat = (ci) ? getfuncname(L, ci, &ar->name) : NULL;
if (ar->namewhat == NULL) {
Expand Down
1 change: 1 addition & 0 deletions src/lua.h
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ struct lua_Debug {
/* private part */
int i_ci; /* active function */
int instruction; /* (i) current instruction offset */
int istailcall; /* (t) whether the stack entry is a tail call */
};

/* }====================================================================== */
Expand Down

0 comments on commit 9458a84

Please sign in to comment.