MCPcopy Create free account
hub / github.com/defold/defold / db_sethook

Function db_sethook

engine/lua/src/lua/ldblib.c:257–278  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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