MCPcopy Create free account
hub / github.com/BigPig0/RelayLive / luaD_hook

Function luaD_hook

ThirdParty/lua/lua/ldo.c:232–256  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

230
231
232void luaD_hook (lua_State *L, int event, int line) {
233 lua_Hook hook = L->hook;
234 if (hook && L->allowhook) {
235 CallInfo *ci = L->ci;
236 ptrdiff_t top = savestack(L, L->top);
237 ptrdiff_t ci_top = savestack(L, ci->top);
238 lua_Debug ar;
239 ar.event = event;
240 ar.currentline = line;
241 ar.i_ci = ci;
242 luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */
243 ci->top = L->top + LUA_MINSTACK;
244 lua_assert(ci->top <= L->stack_last);
245 L->allowhook = 0; /* cannot call hooks inside a hook */
246 ci->callstatus |= CIST_HOOKED;
247 lua_unlock(L);
248 (*hook)(L, &ar);
249 lua_lock(L);
250 lua_assert(!L->allowhook);
251 L->allowhook = 1;
252 ci->top = restorestack(L, ci_top);
253 L->top = restorestack(L, top);
254 ci->callstatus &= ~CIST_HOOKED;
255 }
256}
257
258
259static void callhook (lua_State *L, CallInfo *ci) {

Callers 4

luaG_traceexecFunction · 0.85
callhookFunction · 0.85
luaD_precallFunction · 0.85
luaD_poscallFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected