diff options
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/lua51/ldblib.c')
-rw-r--r-- | Build/source/texk/web2c/luatexdir/lua51/ldblib.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/Build/source/texk/web2c/luatexdir/lua51/ldblib.c b/Build/source/texk/web2c/luatexdir/lua51/ldblib.c index 26a19b6a6f6..67de1222a94 100644 --- a/Build/source/texk/web2c/luatexdir/lua51/ldblib.c +++ b/Build/source/texk/web2c/luatexdir/lua51/ldblib.c @@ -1,5 +1,5 @@ /* -** $Id: ldblib.c,v 1.104 2005/12/29 15:32:11 roberto Exp $ +** $Id: ldblib.c,v 1.104.1.3 2008/01/21 13:11:21 roberto Exp $ ** Interface from Lua to its debug API ** See Copyright Notice in lua.h */ @@ -255,24 +255,25 @@ static void gethooktable (lua_State *L) { static int db_sethook (lua_State *L) { - int arg; + int arg, mask, count; + lua_Hook func; lua_State *L1 = getthread(L, &arg); if (lua_isnoneornil(L, arg+1)) { lua_settop(L, arg+1); - lua_sethook(L1, NULL, 0, 0); /* turn off hooks */ + func = NULL; mask = 0; count = 0; /* turn off hooks */ } else { const char *smask = luaL_checkstring(L, arg+2); - int count = luaL_optint(L, arg+3, 0); luaL_checktype(L, arg+1, LUA_TFUNCTION); - lua_sethook(L1, hookf, makemask(smask, count), count); + count = luaL_optint(L, arg+3, 0); + func = hookf; mask = makemask(smask, count); } - gethooktable(L1); - lua_pushlightuserdata(L1, L1); + gethooktable(L); + lua_pushlightuserdata(L, L1); lua_pushvalue(L, arg+1); - lua_xmove(L, L1, 1); - lua_rawset(L1, -3); /* set new hook */ - lua_pop(L1, 1); /* remove hook table */ + lua_rawset(L, -3); /* set new hook */ + lua_pop(L, 1); /* remove hook table */ + lua_sethook(L1, func, mask, count); /* set hooks */ return 0; } @@ -286,11 +287,10 @@ static int db_gethook (lua_State *L) { if (hook != NULL && hook != hookf) /* external hook? */ lua_pushliteral(L, "external hook"); else { - gethooktable(L1); - lua_pushlightuserdata(L1, L1); - lua_rawget(L1, -2); /* get hook */ - lua_remove(L1, -2); /* remove hook table */ - lua_xmove(L1, L, 1); + gethooktable(L); + lua_pushlightuserdata(L, L1); + lua_rawget(L, -2); /* get hook */ + lua_remove(L, -2); /* remove hook table */ } lua_pushstring(L, unmakemask(mask, buff)); lua_pushinteger(L, lua_gethookcount(L1)); |