aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ldebug.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/ldebug.c b/ldebug.c
index bf2a2fa9..0022a628 100644
--- a/ldebug.c
+++ b/ldebug.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldebug.c,v 1.138 2002/11/21 15:16:04 roberto Exp roberto $ 2** $Id: ldebug.c,v 1.139 2002/11/25 17:47:13 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*/
@@ -91,10 +91,12 @@ LUA_API int lua_gethookcount (lua_State *L) {
91 91
92LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) { 92LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) {
93 int status; 93 int status;
94 int ci;
94 lua_lock(L); 95 lua_lock(L);
95 if (L->ci - L->base_ci <= level) status = 0; /* there is no such level */ 96 ci = (L->ci - L->base_ci) - level;
97 if (ci <= 0) status = 0; /* there is no such level */
96 else { 98 else {
97 ar->i_ci = (L->ci - L->base_ci) - level; 99 ar->i_ci = ci;
98 status = 1; 100 status = 1;
99 } 101 }
100 lua_unlock(L); 102 lua_unlock(L);