MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / db_sethook

Function db_sethook

Source/Misc/lua/src/lua.c:11774–11795  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 9

getthreadFunction · 0.85
lua_settopFunction · 0.85
luaL_checktypeFunction · 0.85
makemaskFunction · 0.85
gethooktableFunction · 0.85
lua_pushlightuserdataFunction · 0.85
lua_pushvalueFunction · 0.85
lua_rawsetFunction · 0.85
lua_sethookFunction · 0.85

Tested by

no test coverage detected