summaryrefslogtreecommitdiff
path: root/ldblib.c
diff options
context:
space:
mode:
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 @@
1/* 1/*
2** $Id: ldblib.c,v 1.2 1999/01/11 18:57:35 roberto Exp roberto $ 2** $Id: ldblib.c,v 1.3 1999/01/15 11:36:28 roberto Exp roberto $
3** Interface from Lua to its debug API 3** Interface from Lua to its debug API
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -147,12 +147,11 @@ static int callhook = -1; /* Lua reference to call hook function */
147 147
148 148
149static void dohook (int ref) { 149static void dohook (int ref) {
150 lua_LHFunction oldlinehook = lua_linehook; /* save old hooks */ 150 lua_LHFunction oldlinehook = lua_setlinehook(NULL);
151 lua_CHFunction oldcallhook = lua_callhook; 151 lua_CHFunction oldcallhook = lua_setcallhook(NULL);
152 lua_linehook = NULL; lua_callhook = NULL; /* to avoid recusive calls */
153 lua_callfunction(lua_getref(ref)); 152 lua_callfunction(lua_getref(ref));
154 lua_linehook = oldlinehook; /* restore old hooks */ 153 lua_setlinehook(oldlinehook);
155 lua_callhook = oldcallhook; 154 lua_setcallhook(oldcallhook);
156} 155}
157 156
158 157
@@ -177,12 +176,12 @@ static void setcallhook (void) {
177 lua_unref(callhook); 176 lua_unref(callhook);
178 if (f == LUA_NOOBJECT) { 177 if (f == LUA_NOOBJECT) {
179 callhook = -1; 178 callhook = -1;
180 lua_callhook = NULL; 179 lua_setcallhook(NULL);
181 } 180 }
182 else { 181 else {
183 lua_pushobject(f); 182 lua_pushobject(f);
184 callhook = lua_ref(1); 183 callhook = lua_ref(1);
185 lua_callhook = callf; 184 lua_setcallhook(callf);
186 } 185 }
187} 186}
188 187
@@ -192,12 +191,12 @@ static void setlinehook (void) {
192 lua_unref(linehook); 191 lua_unref(linehook);
193 if (f == LUA_NOOBJECT) { 192 if (f == LUA_NOOBJECT) {
194 linehook = -1; 193 linehook = -1;
195 lua_linehook = NULL; 194 lua_setlinehook(NULL);
196 } 195 }
197 else { 196 else {
198 lua_pushobject(f); 197 lua_pushobject(f);
199 linehook = lua_ref(1); 198 linehook = lua_ref(1);
200 lua_linehook = linef; 199 lua_setlinehook(linef);
201 } 200 }
202} 201}
203 202