From c4ae00a3d107a27d80bd157a135ef115104f98f0 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 18 Nov 2002 13:23:43 -0200 Subject: details --- ldblib.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'ldblib.c') diff --git a/ldblib.c b/ldblib.c index d2566889..b5027ff1 100644 --- a/ldblib.c +++ b/ldblib.c @@ -1,5 +1,5 @@ /* -** $Id: ldblib.c,v 1.70 2002/09/16 19:18:01 roberto Exp roberto $ +** $Id: ldblib.c,v 1.71 2002/11/14 15:41:38 roberto Exp roberto $ ** Interface from Lua to its debug API ** See Copyright Notice in lua.h */ @@ -167,8 +167,13 @@ static int sethook (lua_State *L) { static int gethook (lua_State *L) { char buff[5]; unsigned long mask = lua_gethookmask(L); - lua_pushlightuserdata(L, (void *)&KEY_HOOK); - lua_rawget(L, LUA_REGISTRYINDEX); /* get hook */ + lua_Hook hook = lua_gethook(L); + if (hook != NULL && hook != hookf) /* external hook? */ + lua_pushliteral(L, "external hook"); + else { + lua_pushlightuserdata(L, (void *)&KEY_HOOK); + lua_rawget(L, LUA_REGISTRYINDEX); /* get hook */ + } lua_pushstring(L, unmakemask(mask, buff)); lua_pushnumber(L, lua_getmaskcount(mask)); return 3; -- cgit v1.2.3-55-g6feb