diff options
Diffstat (limited to 'ltests.c')
-rw-r--r-- | ltests.c | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.c,v 1.46 2000/10/02 14:47:43 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 1.47 2000/10/02 20:10:55 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 | */ |
@@ -93,7 +93,8 @@ static int listcode (lua_State *L) { | |||
93 | int pc; | 93 | int pc; |
94 | Proto *p; | 94 | Proto *p; |
95 | int res; | 95 | int res; |
96 | luaL_arg_check(L, lua_tag(L, 1) == TAG_LCLOSURE, 1, "Lua function expected"); | 96 | luaL_arg_check(L, lua_isfunction(L, 1) && !lua_iscfunction(L, 1), |
97 | 1, "Lua function expected"); | ||
97 | p = clvalue(luaA_index(L, 1))->f.l; | 98 | p = clvalue(luaA_index(L, 1))->f.l; |
98 | lua_newtable(L); | 99 | lua_newtable(L); |
99 | setnameval(L, "maxstack", p->maxstacksize); | 100 | setnameval(L, "maxstack", p->maxstacksize); |
@@ -111,7 +112,8 @@ static int listcode (lua_State *L) { | |||
111 | static int liststrings (lua_State *L) { | 112 | static int liststrings (lua_State *L) { |
112 | Proto *p; | 113 | Proto *p; |
113 | int i; | 114 | int i; |
114 | luaL_arg_check(L, lua_tag(L, 1) == TAG_LCLOSURE, 1, "Lua function expected"); | 115 | luaL_arg_check(L, lua_isfunction(L, 1) && !lua_iscfunction(L, 1), |
116 | 1, "Lua function expected"); | ||
115 | p = clvalue(luaA_index(L, 1))->f.l; | 117 | p = clvalue(luaA_index(L, 1))->f.l; |
116 | lua_newtable(L); | 118 | lua_newtable(L); |
117 | for (i=0; i<p->nkstr; i++) { | 119 | for (i=0; i<p->nkstr; i++) { |
@@ -128,7 +130,8 @@ static int listlocals (lua_State *L) { | |||
128 | int pc = luaL_check_int(L, 2) - 1; | 130 | int pc = luaL_check_int(L, 2) - 1; |
129 | int i = 0; | 131 | int i = 0; |
130 | const char *name; | 132 | const char *name; |
131 | luaL_arg_check(L, lua_tag(L, 1) == TAG_LCLOSURE, 1, "Lua function expected"); | 133 | luaL_arg_check(L, lua_isfunction(L, 1) && !lua_iscfunction(L, 1), |
134 | 1, "Lua function expected"); | ||
132 | p = clvalue(luaA_index(L, 1))->f.l; | 135 | p = clvalue(luaA_index(L, 1))->f.l; |
133 | while ((name = luaF_getlocalname(p, ++i, pc)) != NULL) | 136 | while ((name = luaF_getlocalname(p, ++i, pc)) != NULL) |
134 | lua_pushstring(L, name); | 137 | lua_pushstring(L, name); |
@@ -177,7 +180,7 @@ static int mem_query (lua_State *L) { | |||
177 | 180 | ||
178 | static int hash_query (lua_State *L) { | 181 | static int hash_query (lua_State *L) { |
179 | if (lua_isnull(L, 2)) { | 182 | if (lua_isnull(L, 2)) { |
180 | luaL_arg_check(L, lua_tag(L, 1) == TAG_STRING, 1, "string expected"); | 183 | luaL_arg_check(L, lua_tag(L, 1) == LUA_TSTRING, 1, "string expected"); |
181 | lua_pushnumber(L, tsvalue(luaA_index(L, 1))->u.s.hash); | 184 | lua_pushnumber(L, tsvalue(luaA_index(L, 1))->u.s.hash); |
182 | } | 185 | } |
183 | else { | 186 | else { |
@@ -226,7 +229,7 @@ static int string_query (lua_State *L) { | |||
226 | TString *ts; | 229 | TString *ts; |
227 | int n = 0; | 230 | int n = 0; |
228 | for (ts = tb->hash[s]; ts; ts = ts->nexthash) { | 231 | for (ts = tb->hash[s]; ts; ts = ts->nexthash) { |
229 | ttype(L->top) = TAG_STRING; | 232 | ttype(L->top) = LUA_TSTRING; |
230 | tsvalue(L->top) = ts; | 233 | tsvalue(L->top) = ts; |
231 | incr_top; | 234 | incr_top; |
232 | n++; | 235 | n++; |