diff options
| -rw-r--r-- | ldblib.c | 19 | ||||
| -rw-r--r-- | ldebug.c | 10 | ||||
| -rw-r--r-- | lua.h | 4 |
3 files changed, 25 insertions, 8 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldblib.c,v 1.117 2009/11/24 12:05:44 roberto Exp roberto $ | 2 | ** $Id: ldblib.c,v 1.118 2009/11/25 15:27:51 roberto Exp roberto $ |
| 3 | ** Interface from Lua to its debug API | 3 | ** Interface from Lua to its debug API |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -73,6 +73,12 @@ static void settabsi (lua_State *L, const char *i, int v) { | |||
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | 75 | ||
| 76 | static void settabsb (lua_State *L, const char *i, int v) { | ||
| 77 | lua_pushboolean(L, v); | ||
| 78 | lua_setfield(L, -2, i); | ||
| 79 | } | ||
| 80 | |||
| 81 | |||
| 76 | static lua_State *getthread (lua_State *L, int *arg) { | 82 | static lua_State *getthread (lua_State *L, int *arg) { |
| 77 | if (lua_isthread(L, 1)) { | 83 | if (lua_isthread(L, 1)) { |
| 78 | *arg = 1; | 84 | *arg = 1; |
| @@ -127,16 +133,17 @@ static int db_getinfo (lua_State *L) { | |||
| 127 | } | 133 | } |
| 128 | if (strchr(options, 'l')) | 134 | if (strchr(options, 'l')) |
| 129 | settabsi(L, "currentline", ar.currentline); | 135 | settabsi(L, "currentline", ar.currentline); |
| 130 | if (strchr(options, 'u')) | 136 | if (strchr(options, 'u')) { |
| 131 | settabsi(L, "nups", ar.nups); | 137 | settabsi(L, "nups", ar.nups); |
| 138 | settabsi(L, "nparams", ar.nparams); | ||
| 139 | settabsb(L, "isvararg", ar.isvararg); | ||
| 140 | } | ||
| 132 | if (strchr(options, 'n')) { | 141 | if (strchr(options, 'n')) { |
| 133 | settabss(L, "name", ar.name); | 142 | settabss(L, "name", ar.name); |
| 134 | settabss(L, "namewhat", ar.namewhat); | 143 | settabss(L, "namewhat", ar.namewhat); |
| 135 | } | 144 | } |
| 136 | if (strchr(options, 't')) { | 145 | if (strchr(options, 't')) |
| 137 | lua_pushboolean(L, ar.istailcall); | 146 | settabsb(L, "istailcall", ar.istailcall); |
| 138 | lua_setfield(L, -2, "istailcall"); | ||
| 139 | } | ||
| 140 | if (strchr(options, 'L')) | 147 | if (strchr(options, 'L')) |
| 141 | treatstackoption(L, L1, "activelines"); | 148 | treatstackoption(L, L1, "activelines"); |
| 142 | if (strchr(options, 'f')) | 149 | if (strchr(options, 'f')) |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldebug.c,v 2.59 2009/11/26 15:34:15 roberto Exp roberto $ | 2 | ** $Id: ldebug.c,v 2.60 2009/12/01 16:31:04 roberto Exp roberto $ |
| 3 | ** Debug Interface | 3 | ** Debug Interface |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -192,6 +192,14 @@ static int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar, | |||
| 192 | } | 192 | } |
| 193 | case 'u': { | 193 | case 'u': { |
| 194 | ar->nups = f->c.nupvalues; | 194 | ar->nups = f->c.nupvalues; |
| 195 | if (f->c.isC) { | ||
| 196 | ar->isvararg = 1; | ||
| 197 | ar->nparams = 0; | ||
| 198 | } | ||
| 199 | else { | ||
| 200 | ar->isvararg = f->l.p->is_vararg; | ||
| 201 | ar->nparams = f->l.p->numparams; | ||
| 202 | } | ||
| 195 | break; | 203 | break; |
| 196 | } | 204 | } |
| 197 | case 't': { | 205 | case 't': { |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lua.h,v 1.257 2009/12/22 16:47:00 roberto Exp roberto $ | 2 | ** $Id: lua.h,v 1.258 2010/01/05 18:33:26 roberto Exp roberto $ |
| 3 | ** Lua - A Scripting Language | 3 | ** Lua - A Scripting Language |
| 4 | ** Lua.org, PUC-Rio, Brazil (http://www.lua.org) | 4 | ** Lua.org, PUC-Rio, Brazil (http://www.lua.org) |
| 5 | ** See Copyright Notice at the end of this file | 5 | ** See Copyright Notice at the end of this file |
| @@ -407,6 +407,8 @@ struct lua_Debug { | |||
| 407 | int linedefined; /* (S) */ | 407 | int linedefined; /* (S) */ |
| 408 | int lastlinedefined; /* (S) */ | 408 | int lastlinedefined; /* (S) */ |
| 409 | unsigned char nups; /* (u) number of upvalues */ | 409 | unsigned char nups; /* (u) number of upvalues */ |
| 410 | unsigned char nparams;/* (u) number of parameters */ | ||
| 411 | char isvararg; /* (u) */ | ||
| 410 | char istailcall; /* (t) */ | 412 | char istailcall; /* (t) */ |
| 411 | char short_src[LUA_IDSIZE]; /* (S) */ | 413 | char short_src[LUA_IDSIZE]; /* (S) */ |
| 412 | /* private part */ | 414 | /* private part */ |
