summaryrefslogtreecommitdiff
path: root/ldblib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-02-04 15:47:59 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-02-04 15:47:59 -0200
commit568794956025183fc9a9b79e0c818a885e3d0aeb (patch)
tree02d1a74d7c9a16ca06e94ab4308694ad04f49012 /ldblib.c
parent19de5b22054f6da2c3e0eb3138cc7a1195aab4fd (diff)
downloadlua-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.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/ldblib.c b/ldblib.c
index beb7c700..6e8cc5b7 100644
--- a/ldblib.c
+++ b/ldblib.c
@@ -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);
}
}