/* Call a hook. */ static void callhook(lua_State *L, int event, BCLine line) { global_State *g = G(L); lua_Hook hookf = g->hookf; if (hookf && !hook_active(g)) { lua_Debug ar; lj_trace_abort(g); /* Abort recording on any hook call. */ ar.event = event; ar.currentline = line; ar.i_ci = cast_int((L->base-1) - L->stack); /* Top frame, nextframe=NULL. */ lj_state_checkstack(L, 1+LUA_MINSTACK); hook_enter(g); hookf(L, &ar); lua_assert(hook_active(g)); hook_leave(g); } }
static void linef (lua_State *L, lua_Debug *ar) { lua_pushnumber(L, ar->currentline); hookf(L, KEY_LINEHOOK); }
static void callf (lua_State *L, lua_Debug *ar) { lua_pushstring(L, ar->event); hookf(L, KEY_CALLHOOK); }