summaryrefslogtreecommitdiff
path: root/lua.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-11-25 15:47:13 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-11-25 15:47:13 -0200
commit5f698f8b6f7e5fb18e0a7386dc506b0d5b538e6b (patch)
tree30ae565e9ca884a66c3cca023d24950972e02b0b /lua.c
parent9b1c586b2f5b86173bf0ceca8a0dd84510af9024 (diff)
downloadlua-github-5f698f8b6f7e5fb18e0a7386dc506b0d5b538e6b.tar.gz
simpler interface to hooks + use of `int' to count hooks
Diffstat (limited to 'lua.c')
-rw-r--r--lua.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/lua.c b/lua.c
index 13657e35..cc03d08f 100644
--- a/lua.c
+++ b/lua.c
@@ -1,5 +1,5 @@
/*
-** $Id: lua.c,v 1.108 2002/11/14 15:42:05 roberto Exp roberto $
+** $Id: lua.c,v 1.109 2002/11/19 13:49:43 roberto Exp roberto $
** Lua stand-alone interpreter
** See Copyright Notice in lua.h
*/
@@ -57,9 +57,6 @@ static lua_State *L = NULL;
static const char *progname;
-static lua_Hook old_hook = NULL;
-static unsigned long old_mask = 0;
-
static const luaL_reg lualibs[] = {
{"baselib", lua_baselibopen},
@@ -77,7 +74,7 @@ static const luaL_reg lualibs[] = {
static void lstop (lua_State *l, lua_Debug *ar) {
(void)ar; /* unused arg. */
- lua_sethook(l, old_hook, old_mask);
+ lua_sethook(l, NULL, 0, 0);
luaL_error(l, "interrupted!");
}
@@ -85,9 +82,7 @@ static void lstop (lua_State *l, lua_Debug *ar) {
static void laction (int i) {
signal(i, SIG_DFL); /* if another SIGINT happens before lstop,
terminate process (default action) */
- old_hook = lua_gethook(L);
- old_mask = lua_gethookmask(L);
- lua_sethook(L, lstop, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT(1));
+ lua_sethook(L, lstop, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1);
}