diff options
-rw-r--r-- | ldebug.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldebug.c,v 2.13 2005/04/04 18:12:51 roberto Exp roberto $ | 2 | ** $Id: ldebug.c,v 2.14 2005/04/05 13:41:29 roberto Exp roberto $ |
3 | ** Debug Interface | 3 | ** Debug Interface |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -90,15 +90,15 @@ LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) { | |||
90 | if (f_isLua(ci)) /* Lua function? */ | 90 | if (f_isLua(ci)) /* Lua function? */ |
91 | level -= ci->tailcalls; /* skip lost tail calls */ | 91 | level -= ci->tailcalls; /* skip lost tail calls */ |
92 | } | 92 | } |
93 | if (level > 0 || ci == L->base_ci) status = 0; /* there is no such level */ | 93 | if (level == 0 && ci > L->base_ci) { /* level found? */ |
94 | else if (level < 0) { /* level is of a lost tail call */ | ||
95 | status = 1; | 94 | status = 1; |
96 | ar->i_ci = 0; | 95 | ar->i_ci = ci - L->base_ci; |
97 | } | 96 | } |
98 | else { | 97 | else if (level < 0) { /* level is of a lost tail call? */ |
99 | status = 1; | 98 | status = 1; |
100 | ar->i_ci = ci - L->base_ci; | 99 | ar->i_ci = 0; |
101 | } | 100 | } |
101 | else status = 0; /* no such level */ | ||
102 | lua_unlock(L); | 102 | lua_unlock(L); |
103 | return status; | 103 | return status; |
104 | } | 104 | } |