MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / db_gethook

Function db_gethook

3rd/lua-5.4.3/src/ldblib.c:395–417  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

393
394
395static int db_gethook (lua_State *L) {
396 int arg;
397 lua_State *L1 = getthread(L, &arg);
398 char buff[5];
399 int mask = lua_gethookmask(L1);
400 lua_Hook hook = lua_gethook(L1);
401 if (hook == NULL) { /* no hook? */
402 luaL_pushfail(L);
403 return 1;
404 }
405 else if (hook != hookf) /* external hook? */
406 lua_pushliteral(L, "external hook");
407 else { /* hook table must exist */
408 lua_getfield(L, LUA_REGISTRYINDEX, HOOKKEY);
409 checkstack(L, L1, 1);
410 lua_pushthread(L1); lua_xmove(L1, L, 1);
411 lua_rawget(L, -2); /* 1st result = hooktable[L1] */
412 lua_remove(L, -2); /* remove hook table */
413 }
414 lua_pushstring(L, unmakemask(mask, buff)); /* 2nd result = mask */
415 lua_pushinteger(L, lua_gethookcount(L1)); /* 3rd result = count */
416 return 3;
417}
418
419
420static int db_debug (lua_State *L) {

Callers

nothing calls this directly

Calls 12

getthreadFunction · 0.85
lua_gethookmaskFunction · 0.85
lua_gethookFunction · 0.85
lua_getfieldFunction · 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
lua_gethookcountFunction · 0.85

Tested by

no test coverage detected