MCPcopy Create free account
hub / github.com/F-Stack/f-stack / luaD_hook

Function luaD_hook

freebsd/contrib/openzfs/module/lua/ldo.c:287–311  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

285
286
287void luaD_hook (lua_State *L, int event, int line) {
288 lua_Hook hook = L->hook;
289 if (hook && L->allowhook) {
290 CallInfo *ci = L->ci;
291 ptrdiff_t top = savestack(L, L->top);
292 ptrdiff_t ci_top = savestack(L, ci->top);
293 lua_Debug ar;
294 ar.event = event;
295 ar.currentline = line;
296 ar.i_ci = ci;
297 luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */
298 ci->top = L->top + LUA_MINSTACK;
299 lua_assert(ci->top <= L->stack_last);
300 L->allowhook = 0; /* cannot call hooks inside a hook */
301 ci->callstatus |= CIST_HOOKED;
302 lua_unlock(L);
303 (*hook)(L, &ar);
304 lua_lock(L);
305 lua_assert(!L->allowhook);
306 L->allowhook = 1;
307 ci->top = restorestack(L, ci_top);
308 L->top = restorestack(L, top);
309 ci->callstatus &= ~CIST_HOOKED;
310 }
311}
312
313
314static void callhook (lua_State *L, CallInfo *ci) {

Callers 4

traceexecFunction · 0.85
callhookFunction · 0.85
luaD_precallFunction · 0.85
luaD_poscallFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected