MCPcopy Create free account
hub / github.com/ArduPilot/ardupilot / luaD_hook

Function luaD_hook

libraries/AP_Scripting/lua/src/ldo.c:262–286  ·  view source on GitHub ↗

** Call a hook for the given event. Make sure there is a hook to be ** called. (Both 'L->hook' and 'L->hookmask', which triggers this ** function, can be changed asynchronously by signals.) */

Source from the content-addressed store, hash-verified

260** function, can be changed asynchronously by signals.)
261*/
262void luaD_hook (lua_State *L, int event, int line) {
263 lua_Hook hook = L->hook;
264 if (hook && L->allowhook) { /* make sure there is a hook */
265 CallInfo *ci = L->ci;
266 ptrdiff_t top = savestack(L, L->top);
267 ptrdiff_t ci_top = savestack(L, ci->top);
268 lua_Debug ar;
269 ar.event = event;
270 ar.currentline = line;
271 ar.i_ci = ci;
272 luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */
273 ci->top = L->top + LUA_MINSTACK;
274 lua_assert(ci->top <= L->stack_last);
275 L->allowhook = 0; /* cannot call hooks inside a hook */
276 ci->callstatus |= CIST_HOOKED;
277 lua_unlock(L);
278 (*hook)(L, &ar);
279 lua_lock(L);
280 lua_assert(!L->allowhook);
281 L->allowhook = 1;
282 ci->top = restorestack(L, ci_top);
283 L->top = restorestack(L, top);
284 ci->callstatus &= ~CIST_HOOKED;
285 }
286}
287
288
289static void callhook (lua_State *L, CallInfo *ci) {

Callers 4

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

Calls

no outgoing calls

Tested by

no test coverage detected