diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-02-04 15:47:59 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-02-04 15:47:59 -0200 |
commit | 568794956025183fc9a9b79e0c818a885e3d0aeb (patch) | |
tree | 02d1a74d7c9a16ca06e94ab4308694ad04f49012 /ldblib.c | |
parent | 19de5b22054f6da2c3e0eb3138cc7a1195aab4fd (diff) | |
download | lua-github-568794956025183fc9a9b79e0c818a885e3d0aeb.tar.gz |
"lua_debug", "lua_callhook" and "lua_linehook" must be inside "lua_state".
Diffstat (limited to 'ldblib.c')
-rw-r--r-- | ldblib.c | 19 |
1 files changed, 9 insertions, 10 deletions
@@ -1,5 +1,5 @@ /* -** $Id: ldblib.c,v 1.2 1999/01/11 18:57:35 roberto Exp roberto $ +** $Id: ldblib.c,v 1.3 1999/01/15 11:36:28 roberto Exp roberto $ ** Interface from Lua to its debug API ** See Copyright Notice in lua.h */ @@ -147,12 +147,11 @@ static int callhook = -1; /* Lua reference to call hook function */ static void dohook (int ref) { - lua_LHFunction oldlinehook = lua_linehook; /* save old hooks */ - lua_CHFunction oldcallhook = lua_callhook; - lua_linehook = NULL; lua_callhook = NULL; /* to avoid recusive calls */ + lua_LHFunction oldlinehook = lua_setlinehook(NULL); + lua_CHFunction oldcallhook = lua_setcallhook(NULL); lua_callfunction(lua_getref(ref)); - lua_linehook = oldlinehook; /* restore old hooks */ - lua_callhook = oldcallhook; + lua_setlinehook(oldlinehook); + lua_setcallhook(oldcallhook); } @@ -177,12 +176,12 @@ static void setcallhook (void) { lua_unref(callhook); if (f == LUA_NOOBJECT) { callhook = -1; - lua_callhook = NULL; + lua_setcallhook(NULL); } else { lua_pushobject(f); callhook = lua_ref(1); - lua_callhook = callf; + lua_setcallhook(callf); } } @@ -192,12 +191,12 @@ static void setlinehook (void) { lua_unref(linehook); if (f == LUA_NOOBJECT) { linehook = -1; - lua_linehook = NULL; + lua_setlinehook(NULL); } else { lua_pushobject(f); linehook = lua_ref(1); - lua_linehook = linef; + lua_setlinehook(linef); } } |