From 5bcfe0c700c1001b7e94e76214be12249bc051c7 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 6 Jan 2010 12:42:35 -0200 Subject: new debug info 'isvararg' and 'nparams' --- ldblib.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'ldblib.c') diff --git a/ldblib.c b/ldblib.c index ce14d7dc..be132a3f 100644 --- a/ldblib.c +++ b/ldblib.c @@ -1,5 +1,5 @@ /* -** $Id: ldblib.c,v 1.117 2009/11/24 12:05:44 roberto Exp roberto $ +** $Id: ldblib.c,v 1.118 2009/11/25 15:27:51 roberto Exp roberto $ ** Interface from Lua to its debug API ** See Copyright Notice in lua.h */ @@ -73,6 +73,12 @@ static void settabsi (lua_State *L, const char *i, int v) { } +static void settabsb (lua_State *L, const char *i, int v) { + lua_pushboolean(L, v); + lua_setfield(L, -2, i); +} + + static lua_State *getthread (lua_State *L, int *arg) { if (lua_isthread(L, 1)) { *arg = 1; @@ -127,16 +133,17 @@ static int db_getinfo (lua_State *L) { } if (strchr(options, 'l')) settabsi(L, "currentline", ar.currentline); - if (strchr(options, 'u')) + if (strchr(options, 'u')) { settabsi(L, "nups", ar.nups); + settabsi(L, "nparams", ar.nparams); + settabsb(L, "isvararg", ar.isvararg); + } if (strchr(options, 'n')) { settabss(L, "name", ar.name); settabss(L, "namewhat", ar.namewhat); } - if (strchr(options, 't')) { - lua_pushboolean(L, ar.istailcall); - lua_setfield(L, -2, "istailcall"); - } + if (strchr(options, 't')) + settabsb(L, "istailcall", ar.istailcall); if (strchr(options, 'L')) treatstackoption(L, L1, "activelines"); if (strchr(options, 'f')) -- cgit v1.2.3-55-g6feb