MCPcopy Create free account
hub / github.com/DFHack/dfhack / db_gethook

Function db_gethook

depends/lua/src/ldblib.c:379–399  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

377
378
379static 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
402static int db_debug (lua_State *L) {

Callers

nothing calls this directly

Calls 13

getthreadFunction · 0.85
lua_gethookmaskFunction · 0.85
lua_gethookFunction · 0.85
lua_pushnilFunction · 0.85
lua_rawgetpFunction · 0.85
checkstackFunction · 0.85
lua_pushthreadFunction · 0.85
lua_xmoveFunction · 0.85
lua_rawgetFunction · 0.85
lua_pushstringFunction · 0.85
unmakemaskFunction · 0.85
lua_pushintegerFunction · 0.85

Tested by

no test coverage detected