aboutsummaryrefslogtreecommitdiff
path: root/lua.c
diff options
context:
space:
mode:
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 @@
1/* 1/*
2** $Id: lua.c,v 1.108 2002/11/14 15:42:05 roberto Exp roberto $ 2** $Id: lua.c,v 1.109 2002/11/19 13:49:43 roberto Exp roberto $
3** Lua stand-alone interpreter 3** Lua stand-alone interpreter
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -57,9 +57,6 @@ static lua_State *L = NULL;
57static const char *progname; 57static const char *progname;
58 58
59 59
60static lua_Hook old_hook = NULL;
61static unsigned long old_mask = 0;
62
63 60
64static const luaL_reg lualibs[] = { 61static const luaL_reg lualibs[] = {
65 {"baselib", lua_baselibopen}, 62 {"baselib", lua_baselibopen},
@@ -77,7 +74,7 @@ static const luaL_reg lualibs[] = {
77 74
78static void lstop (lua_State *l, lua_Debug *ar) { 75static void lstop (lua_State *l, lua_Debug *ar) {
79 (void)ar; /* unused arg. */ 76 (void)ar; /* unused arg. */
80 lua_sethook(l, old_hook, old_mask); 77 lua_sethook(l, NULL, 0, 0);
81 luaL_error(l, "interrupted!"); 78 luaL_error(l, "interrupted!");
82} 79}
83 80
@@ -85,9 +82,7 @@ static void lstop (lua_State *l, lua_Debug *ar) {
85static void laction (int i) { 82static void laction (int i) {
86 signal(i, SIG_DFL); /* if another SIGINT happens before lstop, 83 signal(i, SIG_DFL); /* if another SIGINT happens before lstop,
87 terminate process (default action) */ 84 terminate process (default action) */
88 old_hook = lua_gethook(L); 85 lua_sethook(L, lstop, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1);
89 old_mask = lua_gethookmask(L);
90 lua_sethook(L, lstop, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT(1));
91} 86}
92 87
93 88