1
0
mirror of https://github.com/lua/lua.git synced 2025-01-14 05:43:00 +08:00
This commit is contained in:
Roberto Ierusalimschy 2002-11-26 06:59:48 -02:00
parent 8954bdc706
commit c194a46bc5

View File

@ -1,5 +1,5 @@
/*
** $Id: ldebug.c,v 1.138 2002/11/21 15:16:04 roberto Exp roberto $
** $Id: ldebug.c,v 1.139 2002/11/25 17:47:13 roberto Exp roberto $
** Debug Interface
** See Copyright Notice in lua.h
*/
@ -91,10 +91,12 @@ LUA_API int lua_gethookcount (lua_State *L) {
LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) {
int status;
int ci;
lua_lock(L);
if (L->ci - L->base_ci <= level) status = 0; /* there is no such level */
ci = (L->ci - L->base_ci) - level;
if (ci <= 0) status = 0; /* there is no such level */
else {
ar->i_ci = (L->ci - L->base_ci) - level;
ar->i_ci = ci;
status = 1;
}
lua_unlock(L);