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

Function lua_sethook

libraries/AP_Scripting/lua/src/ldebug.c:82–93  ·  view source on GitHub ↗

** This function can be called asynchronously (e.g. during a signal). ** Fields 'oldpc', 'basehookcount', and 'hookcount' (set by ** 'resethookcount') are for debug only, and it is no problem if they ** get arbitrary values (causes at most one wrong hook call). 'hookmask' ** is an atomic value. We assume that pointers are atomic too (e.g., gcc ** ensures that for all platforms where it runs). More

Source from the content-addressed store, hash-verified

80** always checked before being called (see 'luaD_hook').
81*/
82LUA_API void lua_sethook (lua_State *L, lua_Hook func, int mask, int count) {
83 if (func == NULL || mask == 0) { /* turn off hooks? */
84 mask = 0;
85 func = NULL;
86 }
87 if (isLua(L->ci))
88 L->oldpc = L->ci->u.l.savedpc;
89 L->hook = func;
90 L->basehookcount = count;
91 resethookcount(L);
92 L->hookmask = cast_byte(mask);
93}
94
95
96LUA_API lua_Hook lua_gethook (lua_State *L) {

Callers 5

hookMethod · 0.85
reset_loop_overtimeMethod · 0.85
lstopFunction · 0.85
lactionFunction · 0.85
db_sethookFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected