commit 4973682294a32b9c4286864179685d11ad4a6819
parent 6acfb91c8d4dd1174545537ef85e1dacfdb04633
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Tue, 21 Sep 2004 14:57:44 -0300
small bug with coroutine tracebacks
Diffstat:
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/ldblib.c b/ldblib.c
@@ -1,5 +1,5 @@
/*
-** $Id: ldblib.c,v 1.86 2004/05/31 19:27:14 roberto Exp roberto $
+** $Id: ldblib.c,v 1.87 2004/08/13 18:02:36 roberto Exp roberto $
** Interface from Lua to its debug API
** See Copyright Notice in lua.h
*/
@@ -275,14 +275,15 @@ static int debug (lua_State *L) {
#define LEVELS2 10 /* size of the second part of the stack */
static int errorfb (lua_State *L) {
- int level = 1; /* skip level 0 (it's this function) */
+ int level = 0;
int firstpart = 1; /* still before eventual `...' */
int arg;
lua_State *L1 = getthread(L, &arg);
lua_Debug ar;
+ if (L == L1) level++; /* skip level 0 (it's this function) */
if (lua_gettop(L) == arg)
lua_pushliteral(L, "");
- else if (!lua_isstring(L, arg+1)) return 1; /* no string message */
+ else if (!lua_isstring(L, arg+1)) return 1; /* message is not a string */
else lua_pushliteral(L, "\n");
lua_pushliteral(L, "stack traceback:");
while (lua_getstack(L1, level++, &ar)) {