diff options
| -rw-r--r-- | ldblib.c | 22 |
1 files changed, 10 insertions, 12 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldblib.c,v 1.107 2007/06/22 15:33:54 roberto Exp roberto $ | 2 | ** $Id: ldblib.c,v 1.108 2008/01/18 17:14:47 roberto Exp roberto $ |
| 3 | ** Interface from Lua to its debug API | 3 | ** Interface from Lua to its debug API |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -268,13 +268,12 @@ static int db_sethook (lua_State *L) { | |||
| 268 | count = luaL_optint(L, arg+3, 0); | 268 | count = luaL_optint(L, arg+3, 0); |
| 269 | func = hookf; mask = makemask(smask, count); | 269 | func = hookf; mask = makemask(smask, count); |
| 270 | } | 270 | } |
| 271 | gethooktable(L1); | 271 | gethooktable(L); |
| 272 | lua_pushlightuserdata(L1, L1); | 272 | lua_pushlightuserdata(L, L1); |
| 273 | lua_pushvalue(L, arg+1); | 273 | lua_pushvalue(L, arg+1); |
| 274 | lua_xmove(L, L1, 1); | 274 | lua_rawset(L, -3); /* set new hook */ |
| 275 | lua_rawset(L1, -3); /* set new hook */ | 275 | lua_pop(L, 1); /* remove hook table */ |
| 276 | lua_pop(L1, 1); /* remove hook table */ | 276 | lua_sethook(L1, func, mask, count); /* set hooks */ |
| 277 | lua_sethook(L1, func, mask, count); | ||
| 278 | return 0; | 277 | return 0; |
| 279 | } | 278 | } |
| 280 | 279 | ||
| @@ -288,11 +287,10 @@ static int db_gethook (lua_State *L) { | |||
| 288 | if (hook != NULL && hook != hookf) /* external hook? */ | 287 | if (hook != NULL && hook != hookf) /* external hook? */ |
| 289 | lua_pushliteral(L, "external hook"); | 288 | lua_pushliteral(L, "external hook"); |
| 290 | else { | 289 | else { |
| 291 | gethooktable(L1); | 290 | gethooktable(L); |
| 292 | lua_pushlightuserdata(L1, L1); | 291 | lua_pushlightuserdata(L, L1); |
| 293 | lua_rawget(L1, -2); /* get hook */ | 292 | lua_rawget(L, -2); /* get hook */ |
| 294 | lua_remove(L1, -2); /* remove hook table */ | 293 | lua_remove(L, -2); /* remove hook table */ |
| 295 | lua_xmove(L1, L, 1); | ||
| 296 | } | 294 | } |
| 297 | lua_pushstring(L, unmakemask(mask, buff)); | 295 | lua_pushstring(L, unmakemask(mask, buff)); |
| 298 | lua_pushinteger(L, lua_gethookcount(L1)); | 296 | lua_pushinteger(L, lua_gethookcount(L1)); |
