From 5f698f8b6f7e5fb18e0a7386dc506b0d5b538e6b Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 25 Nov 2002 15:47:13 -0200 Subject: simpler interface to hooks + use of `int' to count hooks --- ltests.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'ltests.c') diff --git a/ltests.c b/ltests.c index e6643a0c..f1f50364 100644 --- a/ltests.c +++ b/ltests.c @@ -1,5 +1,5 @@ /* -** $Id: ltests.c,v 1.144 2002/11/14 16:59:16 roberto Exp roberto $ +** $Id: ltests.c,v 1.145 2002/11/18 15:24:27 roberto Exp roberto $ ** Internal Module for Debugging of the Lua Implementation ** See Copyright Notice in lua.h */ @@ -702,12 +702,14 @@ static void yieldf (lua_State *L, lua_Debug *ar) { static int setyhook (lua_State *L) { if (lua_isnoneornil(L, 1)) - lua_sethook(L, NULL, 0); /* turn off hooks */ + lua_sethook(L, NULL, 0, 0); /* turn off hooks */ else { const char *smask = luaL_checkstring(L, 1); - unsigned long count = LUA_MASKCOUNT(luaL_optint(L, 2, 0)); - if (strchr(smask, 'l')) count |= LUA_MASKLINE; - lua_sethook(L, yieldf, count); + int count = luaL_optint(L, 2, 0); + int mask = 0; + if (strchr(smask, 'l')) mask |= LUA_MASKLINE; + if (count > 0) mask |= LUA_MASKCOUNT; + lua_sethook(L, yieldf, mask, count); } return 0; } -- cgit v1.2.3-55-g6feb