diff options
-rw-r--r-- | ltests.c | 21 |
1 files changed, 20 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.c,v 1.21 2000/05/26 19:17:57 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 1.22 2000/06/02 17:06:42 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 | */ |
@@ -104,6 +104,24 @@ static void listcode (void) { | |||
104 | lua_pushobject(t); | 104 | lua_pushobject(t); |
105 | } | 105 | } |
106 | 106 | ||
107 | |||
108 | static void liststrings (void) { | ||
109 | lua_Object o = luaL_nonnullarg(1); | ||
110 | lua_Object t = lua_createtable(); | ||
111 | Proto *p; | ||
112 | int i; | ||
113 | luaL_arg_check(ttype(o) == TAG_LCLOSURE, 1, "Lua function expected"); | ||
114 | p = clvalue(o)->f.l; | ||
115 | for (i=0; i<p->nkstr; i++) { | ||
116 | lua_pushobject(t); | ||
117 | lua_pushnumber(i+1); | ||
118 | lua_pushstring(p->kstr[i]->str); | ||
119 | lua_settable(); | ||
120 | } | ||
121 | lua_pushobject(t); | ||
122 | } | ||
123 | |||
124 | |||
107 | /* }====================================================== */ | 125 | /* }====================================================== */ |
108 | 126 | ||
109 | 127 | ||
@@ -377,6 +395,7 @@ static const struct luaL_reg tests_funcs[] = { | |||
377 | {"hash", (lua_CFunction)hash_query}, | 395 | {"hash", (lua_CFunction)hash_query}, |
378 | {"limits", (lua_CFunction)get_limits}, | 396 | {"limits", (lua_CFunction)get_limits}, |
379 | {"listcode", (lua_CFunction)listcode}, | 397 | {"listcode", (lua_CFunction)listcode}, |
398 | {"liststrings", (lua_CFunction)liststrings}, | ||
380 | {"querystr", (lua_CFunction)string_query}, | 399 | {"querystr", (lua_CFunction)string_query}, |
381 | {"querytab", (lua_CFunction)table_query}, | 400 | {"querytab", (lua_CFunction)table_query}, |
382 | {"testC", (lua_CFunction)testC}, | 401 | {"testC", (lua_CFunction)testC}, |