summaryrefslogtreecommitdiff
path: root/ldblib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2004-09-21 14:58:06 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2004-09-21 14:58:06 -0300
commit4973682294a32b9c4286864179685d11ad4a6819 (patch)
treeedd0d80ec447a448a748d50dad282340e5484ea0 /ldblib.c
parent6acfb91c8d4dd1174545537ef85e1dacfdb04633 (diff)
downloadlua-4973682294a32b9c4286864179685d11ad4a6819.tar.gz
lua-4973682294a32b9c4286864179685d11ad4a6819.tar.bz2
lua-4973682294a32b9c4286864179685d11ad4a6819.zip
small bug with coroutine tracebacks
Diffstat (limited to 'ldblib.c')
-rw-r--r--ldblib.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/ldblib.c b/ldblib.c
index 11826e81..09e22176 100644
--- a/ldblib.c
+++ b/ldblib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldblib.c,v 1.86 2004/05/31 19:27:14 roberto Exp roberto $ 2** $Id: ldblib.c,v 1.87 2004/08/13 18:02:36 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*/
@@ -275,14 +275,15 @@ static int debug (lua_State *L) {
275#define LEVELS2 10 /* size of the second part of the stack */ 275#define LEVELS2 10 /* size of the second part of the stack */
276 276
277static int errorfb (lua_State *L) { 277static int errorfb (lua_State *L) {
278 int level = 1; /* skip level 0 (it's this function) */ 278 int level = 0;
279 int firstpart = 1; /* still before eventual `...' */ 279 int firstpart = 1; /* still before eventual `...' */
280 int arg; 280 int arg;
281 lua_State *L1 = getthread(L, &arg); 281 lua_State *L1 = getthread(L, &arg);
282 lua_Debug ar; 282 lua_Debug ar;
283 if (L == L1) level++; /* skip level 0 (it's this function) */
283 if (lua_gettop(L) == arg) 284 if (lua_gettop(L) == arg)
284 lua_pushliteral(L, ""); 285 lua_pushliteral(L, "");
285 else if (!lua_isstring(L, arg+1)) return 1; /* no string message */ 286 else if (!lua_isstring(L, arg+1)) return 1; /* message is not a string */
286 else lua_pushliteral(L, "\n"); 287 else lua_pushliteral(L, "\n");
287 lua_pushliteral(L, "stack traceback:"); 288 lua_pushliteral(L, "stack traceback:");
288 while (lua_getstack(L1, level++, &ar)) { 289 while (lua_getstack(L1, level++, &ar)) {