lua

A copy of the Lua development repository
Log | Files | Refs | README

commit c194a46bc5bfef02708126378526f17afabb9998
parent 8954bdc7060ec9e977e1a3bb085eca487fd4821d
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Tue, 26 Nov 2002 06:59:26 -0200

detail

Diffstat:
Mldebug.c | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/ldebug.c b/ldebug.c @@ -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);