diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-07-15 15:37:19 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-07-15 15:37:19 -0300 |
commit | bd5fa9cc8fdd966edc46c3de2cc420a72240ead3 (patch) | |
tree | 15f713451602e39e8f01ae4311c6c15b92f2448b /ltests.c | |
parent | 2658c94925fbc93991e854afc2e7354f225967aa (diff) | |
download | lua-bd5fa9cc8fdd966edc46c3de2cc420a72240ead3.tar.gz lua-bd5fa9cc8fdd966edc46c3de2cc420a72240ead3.tar.bz2 lua-bd5fa9cc8fdd966edc46c3de2cc420a72240ead3.zip |
new macro 'getproto'
Diffstat (limited to 'ltests.c')
-rw-r--r-- | ltests.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.c,v 2.66 2009/06/17 17:53:14 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 2.67 2009/07/15 17:26:14 roberto Exp roberto $ |
3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -440,7 +440,7 @@ static int listcode (lua_State *L) { | |||
440 | Proto *p; | 440 | Proto *p; |
441 | luaL_argcheck(L, lua_isfunction(L, 1) && !lua_iscfunction(L, 1), | 441 | luaL_argcheck(L, lua_isfunction(L, 1) && !lua_iscfunction(L, 1), |
442 | 1, "Lua function expected"); | 442 | 1, "Lua function expected"); |
443 | p = clvalue(obj_at(L, 1))->l.p; | 443 | p = getproto(obj_at(L, 1)); |
444 | lua_newtable(L); | 444 | lua_newtable(L); |
445 | setnameval(L, "maxstack", p->maxstacksize); | 445 | setnameval(L, "maxstack", p->maxstacksize); |
446 | setnameval(L, "numparams", p->numparams); | 446 | setnameval(L, "numparams", p->numparams); |
@@ -459,7 +459,7 @@ static int listk (lua_State *L) { | |||
459 | int i; | 459 | int i; |
460 | luaL_argcheck(L, lua_isfunction(L, 1) && !lua_iscfunction(L, 1), | 460 | luaL_argcheck(L, lua_isfunction(L, 1) && !lua_iscfunction(L, 1), |
461 | 1, "Lua function expected"); | 461 | 1, "Lua function expected"); |
462 | p = clvalue(obj_at(L, 1))->l.p; | 462 | p = getproto(obj_at(L, 1)); |
463 | lua_createtable(L, p->sizek, 0); | 463 | lua_createtable(L, p->sizek, 0); |
464 | for (i=0; i<p->sizek; i++) { | 464 | for (i=0; i<p->sizek; i++) { |
465 | pushobject(L, p->k+i); | 465 | pushobject(L, p->k+i); |
@@ -476,7 +476,7 @@ static int listlocals (lua_State *L) { | |||
476 | const char *name; | 476 | const char *name; |
477 | luaL_argcheck(L, lua_isfunction(L, 1) && !lua_iscfunction(L, 1), | 477 | luaL_argcheck(L, lua_isfunction(L, 1) && !lua_iscfunction(L, 1), |
478 | 1, "Lua function expected"); | 478 | 1, "Lua function expected"); |
479 | p = clvalue(obj_at(L, 1))->l.p; | 479 | p = getproto(obj_at(L, 1)); |
480 | while ((name = luaF_getlocalname(p, ++i, pc)) != NULL) | 480 | while ((name = luaF_getlocalname(p, ++i, pc)) != NULL) |
481 | lua_pushstring(L, name); | 481 | lua_pushstring(L, name); |
482 | return i-1; | 482 | return i-1; |