| 393 | |
| 394 | |
| 395 | static int db_gethook (lua_State *L) { |
| 396 | int arg; |
| 397 | lua_State *L1 = getthread(L, &arg); |
| 398 | char buff[5]; |
| 399 | int mask = lua_gethookmask(L1); |
| 400 | lua_Hook hook = lua_gethook(L1); |
| 401 | if (hook == NULL) { /* no hook? */ |
| 402 | luaL_pushfail(L); |
| 403 | return 1; |
| 404 | } |
| 405 | else if (hook != hookf) /* external hook? */ |
| 406 | lua_pushliteral(L, "external hook"); |
| 407 | else { /* hook table must exist */ |
| 408 | lua_getfield(L, LUA_REGISTRYINDEX, HOOKKEY); |
| 409 | checkstack(L, L1, 1); |
| 410 | lua_pushthread(L1); lua_xmove(L1, L, 1); |
| 411 | lua_rawget(L, -2); /* 1st result = hooktable[L1] */ |
| 412 | lua_remove(L, -2); /* remove hook table */ |
| 413 | } |
| 414 | lua_pushstring(L, unmakemask(mask, buff)); /* 2nd result = mask */ |
| 415 | lua_pushinteger(L, lua_gethookcount(L1)); /* 3rd result = count */ |
| 416 | return 3; |
| 417 | } |
| 418 | |
| 419 | |
| 420 | static int db_debug (lua_State *L) { |
nothing calls this directly
no test coverage detected