MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / luaD_callhook

Function luaD_callhook

Source/Misc/lua/src/lua.c:5327–5351  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5325
5326
5327void luaD_callhook (lua_State *L, int event, int line) {
5328lua_Hook hook = L->hook;
5329if (hook && L->allowhook) {
5330ptrdiff_t top = savestack(L, L->top);
5331ptrdiff_t ci_top = savestack(L, L->ci->top);
5332lua_Debug ar;
5333ar.event = event;
5334ar.currentline = line;
5335if (event == LUA_HOOKTAILRET)
5336ar.i_ci = 0; /* tail call; no debug information about it */
5337else
5338ar.i_ci = cast_int(L->ci - L->base_ci);
5339luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */
5340L->ci->top = L->top + LUA_MINSTACK;
5341lua_assert(L->ci->top <= L->stack_last);
5342L->allowhook = 0; /* cannot call hooks inside a hook */
5343lua_unlock(L);
5344(*hook)(L, &ar);
5345lua_lock(L);
5346lua_assert(!L->allowhook);
5347L->allowhook = 1;
5348L->ci->top = restorestack(L, ci_top);
5349L->top = restorestack(L, top);
5350}
5351}
5352
5353
5354static StkId adjust_varargs (lua_State *L, Proto *p, int actual) {

Callers 3

luaD_precallFunction · 0.85
callrethooksFunction · 0.85
traceexecFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected