aboutsummaryrefslogtreecommitdiff
path: root/src/lj_debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_debug.c')
-rw-r--r--src/lj_debug.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/lj_debug.c b/src/lj_debug.c
index 7dba8072..0e26cd7c 100644
--- a/src/lj_debug.c
+++ b/src/lj_debug.c
@@ -423,7 +423,7 @@ LUA_API const char *lua_setlocal(lua_State *L, const lua_Debug *ar, int n)
423 return name; 423 return name;
424} 424}
425 425
426LUA_API int lua_getinfo(lua_State *L, const char *what, lua_Debug *ar) 426int lj_debug_getinfo(lua_State *L, const char *what, lj_Debug *ar, int ext)
427{ 427{
428 int opt_f = 0, opt_L = 0; 428 int opt_f = 0, opt_L = 0;
429 TValue *frame = NULL; 429 TValue *frame = NULL;
@@ -471,6 +471,16 @@ LUA_API int lua_getinfo(lua_State *L, const char *what, lua_Debug *ar)
471 ar->currentline = frame ? debug_frameline(L, fn, nextframe) : -1; 471 ar->currentline = frame ? debug_frameline(L, fn, nextframe) : -1;
472 } else if (*what == 'u') { 472 } else if (*what == 'u') {
473 ar->nups = fn->c.nupvalues; 473 ar->nups = fn->c.nupvalues;
474 if (ext) {
475 if (isluafunc(fn)) {
476 GCproto *pt = funcproto(fn);
477 ar->nparams = pt->numparams;
478 ar->isvararg = !!(pt->flags & PROTO_VARARG);
479 } else {
480 ar->nparams = 0;
481 ar->isvararg = 1;
482 }
483 }
474 } else if (*what == 'n') { 484 } else if (*what == 'n') {
475 ar->namewhat = frame ? lj_debug_funcname(L, frame, &ar->name) : NULL; 485 ar->namewhat = frame ? lj_debug_funcname(L, frame, &ar->name) : NULL;
476 if (ar->namewhat == NULL) { 486 if (ar->namewhat == NULL) {
@@ -515,6 +525,11 @@ LUA_API int lua_getinfo(lua_State *L, const char *what, lua_Debug *ar)
515 return 1; /* Ok. */ 525 return 1; /* Ok. */
516} 526}
517 527
528LUA_API int lua_getinfo(lua_State *L, const char *what, lua_Debug *ar)
529{
530 return lj_debug_getinfo(L, what, (lj_Debug *)ar, 0);
531}
532
518LUA_API int lua_getstack(lua_State *L, int level, lua_Debug *ar) 533LUA_API int lua_getstack(lua_State *L, int level, lua_Debug *ar)
519{ 534{
520 int size; 535 int size;