MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / luaD_hook

Function luaD_hook

src/Chain/libraries/glua/ldo.cpp:274–298  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

272
273
274void luaD_hook(lua_State *L, int event, int line) {
275 lua_Hook hook = L->hook;
276 if (hook && L->allowhook) {
277 CallInfo *ci = L->ci;
278 ptrdiff_t top = savestack(L, L->top);
279 ptrdiff_t ci_top = savestack(L, ci->top);
280 lua_Debug ar;
281 ar.event = event;
282 ar.currentline = line;
283 ar.i_ci = ci;
284 luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */
285 ci->top = L->top + LUA_MINSTACK;
286 lua_assert(ci->top <= L->stack_last);
287 L->allowhook = 0; /* cannot call hooks inside a hook */
288 ci->callstatus |= CIST_HOOKED;
289 lua_unlock(L);
290 (*hook)(L, &ar);
291 lua_lock(L);
292 lua_assert(!L->allowhook);
293 L->allowhook = 1;
294 ci->top = restorestack(L, ci_top);
295 L->top = restorestack(L, top);
296 ci->callstatus &= ~CIST_HOOKED;
297 }
298}
299
300
301static void callhook(lua_State *L, CallInfo *ci) {

Callers 4

luaG_traceexecFunction · 0.85
callhookFunction · 0.85
ldo.cppFile · 0.85
luaD_poscallFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected