aboutsummaryrefslogtreecommitdiff
path: root/ldebug.c
diff options
context:
space:
mode:
Diffstat (limited to 'ldebug.c')
-rw-r--r--ldebug.c29
1 files changed, 6 insertions, 23 deletions
diff --git a/ldebug.c b/ldebug.c
index 5537fcd3..954c68c0 100644
--- a/ldebug.c
+++ b/ldebug.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldebug.c,v 1.92 2001/10/31 19:58:11 roberto Exp $ 2** $Id: ldebug.c,v 1.1 2001/11/29 22:14:34 rieru Exp rieru $
3** Debug Interface 3** Debug Interface
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -205,22 +205,8 @@ static void funcinfo (lua_State *L, lua_Debug *ar, StkId func) {
205} 205}
206 206
207 207
208static const char *travtagmethods (global_State *G, const TObject *o) {
209 if (ttype(o) == LUA_TFUNCTION) {
210 int e;
211 for (e=0; e<TM_N; e++) {
212 int t;
213 for (t=0; t<G->ntag; t++)
214 if (clvalue(o) == luaT_gettm(G, t, e))
215 return luaT_eventname[e];
216 }
217 }
218 return NULL;
219}
220
221
222static const char *travglobals (lua_State *L, const TObject *o) { 208static const char *travglobals (lua_State *L, const TObject *o) {
223 Table *g = hvalue(&L->gt); 209 Table *g = hvalue(gt(L));
224 int i = sizenode(g); 210 int i = sizenode(g);
225 while (i--) { 211 while (i--) {
226 Node *n = node(g, i); 212 Node *n = node(g, i);
@@ -235,10 +221,7 @@ static void getname (lua_State *L, const TObject *f, lua_Debug *ar) {
235 /* try to find a name for given function */ 221 /* try to find a name for given function */
236 if ((ar->name = travglobals(L, f)) != NULL) 222 if ((ar->name = travglobals(L, f)) != NULL)
237 ar->namewhat = "global"; 223 ar->namewhat = "global";
238 /* not found: try tag methods */ 224 else ar->namewhat = ""; /* not found */
239 else if ((ar->name = travtagmethods(G(L), f)) != NULL)
240 ar->namewhat = "tag-method";
241 else ar->namewhat = ""; /* not found at all */
242} 225}
243 226
244 227
@@ -531,7 +514,7 @@ static const char *getfuncname (lua_State *L, CallInfo *ci,
531void luaG_typeerror (lua_State *L, StkId o, const char *op) { 514void luaG_typeerror (lua_State *L, StkId o, const char *op) {
532 const char *name; 515 const char *name;
533 const char *kind = getobjname(L, o, &name); 516 const char *kind = getobjname(L, o, &name);
534 const char *t = luaT_typename(G(L), o); 517 const char *t = luaT_typenames[ttype(o)];
535 if (kind) 518 if (kind)
536 luaO_verror(L, "attempt to %.30s %.20s `%.40s' (a %.10s value)", 519 luaO_verror(L, "attempt to %.30s %.20s `%.40s' (a %.10s value)",
537 op, kind, name, t); 520 op, kind, name, t);
@@ -556,8 +539,8 @@ void luaG_aritherror (lua_State *L, StkId p1, TObject *p2) {
556 539
557 540
558void luaG_ordererror (lua_State *L, const TObject *p1, const TObject *p2) { 541void luaG_ordererror (lua_State *L, const TObject *p1, const TObject *p2) {
559 const char *t1 = luaT_typename(G(L), p1); 542 const char *t1 = luaT_typenames[ttype(p1)];
560 const char *t2 = luaT_typename(G(L), p2); 543 const char *t2 = luaT_typenames[ttype(p2)];
561 if (t1[2] == t2[2]) 544 if (t1[2] == t2[2])
562 luaO_verror(L, "attempt to compare two %.10s values", t1); 545 luaO_verror(L, "attempt to compare two %.10s values", t1);
563 else 546 else