| 377 | |
| 378 | |
| 379 | static int db_gethook (lua_State *L) { |
| 380 | int arg; |
| 381 | lua_State *L1 = getthread(L, &arg); |
| 382 | char buff[5]; |
| 383 | int mask = lua_gethookmask(L1); |
| 384 | lua_Hook hook = lua_gethook(L1); |
| 385 | if (hook == NULL) /* no hook? */ |
| 386 | lua_pushnil(L); |
| 387 | else if (hook != hookf) /* external hook? */ |
| 388 | lua_pushliteral(L, "external hook"); |
| 389 | else { /* hook table must exist */ |
| 390 | lua_rawgetp(L, LUA_REGISTRYINDEX, &HOOKKEY); |
| 391 | checkstack(L, L1, 1); |
| 392 | lua_pushthread(L1); lua_xmove(L1, L, 1); |
| 393 | lua_rawget(L, -2); /* 1st result = hooktable[L1] */ |
| 394 | lua_remove(L, -2); /* remove hook table */ |
| 395 | } |
| 396 | lua_pushstring(L, unmakemask(mask, buff)); /* 2nd result = mask */ |
| 397 | lua_pushinteger(L, lua_gethookcount(L1)); /* 3rd result = count */ |
| 398 | return 3; |
| 399 | } |
| 400 | |
| 401 | |
| 402 | static int db_debug (lua_State *L) { |
nothing calls this directly
no test coverage detected