MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / db_sethook

Function db_sethook

third-party/lua-5.1.5/src/ldblib.c:258–279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

256
257
258static int db_sethook (lua_State *L) {
259 int arg, mask, count;
260 lua_Hook func;
261 lua_State *L1 = getthread(L, &arg);
262 if (lua_isnoneornil(L, arg+1)) {
263 lua_settop(L, arg+1);
264 func = NULL; mask = 0; count = 0; /* turn off hooks */
265 }
266 else {
267 const char *smask = luaL_checkstring(L, arg+2);
268 luaL_checktype(L, arg+1, LUA_TFUNCTION);
269 count = luaL_optint(L, arg+3, 0);
270 func = hookf; mask = makemask(smask, count);
271 }
272 gethooktable(L);
273 lua_pushlightuserdata(L, L1);
274 lua_pushvalue(L, arg+1);
275 lua_rawset(L, -3); /* set new hook */
276 lua_pop(L, 1); /* remove hook table */
277 lua_sethook(L1, func, mask, count); /* set hooks */
278 return 0;
279}
280
281
282static int db_gethook (lua_State *L) {

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected