| 11772 | |
| 11773 | |
| 11774 | static int db_sethook (lua_State *L) { |
| 11775 | int arg, mask, count; |
| 11776 | lua_Hook func; |
| 11777 | lua_State *L1 = getthread(L, &arg); |
| 11778 | if (lua_isnoneornil(L, arg+1)) { |
| 11779 | lua_settop(L, arg+1); |
| 11780 | func = NULL; mask = 0; count = 0; /* turn off hooks */ |
| 11781 | } |
| 11782 | else { |
| 11783 | const char *smask = luaL_checkstring(L, arg+2); |
| 11784 | luaL_checktype(L, arg+1, LUA_TFUNCTION); |
| 11785 | count = luaL_optint(L, arg+3, 0); |
| 11786 | func = hookf; mask = makemask(smask, count); |
| 11787 | } |
| 11788 | gethooktable(L); |
| 11789 | lua_pushlightuserdata(L, L1); |
| 11790 | lua_pushvalue(L, arg+1); |
| 11791 | lua_rawset(L, -3); /* set new hook */ |
| 11792 | lua_pop(L, 1); /* remove hook table */ |
| 11793 | lua_sethook(L1, func, mask, count); /* set hooks */ |
| 11794 | return 0; |
| 11795 | } |
| 11796 | |
| 11797 | |
| 11798 | static int db_gethook (lua_State *L) { |
nothing calls this directly
no test coverage detected