typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);
Type for debugging hook functions.
Whenever a hook is called, its ar argument has its field
event set to the specific event that triggered the hook.
Lua identifies these events with the following constants:
LUA_HOOKCALL , LUA_HOOKRET ,
LUA_HOOKTAILRET , LUA_HOOKLINE ,
and LUA_HOOKCOUNT .
Moreover, for line events, the field currentline is also set.
To get the value of any other field in ar ,
the hook must call lua_getinfo .
For return events, event can be LUA_HOOKRET ,
the normal value, or LUA_HOOKTAILRET .
In the latter case, Lua is simulating a return from
a function that did a tail call;
in this case, it is useless to call lua_getinfo .
While Lua is running a hook, it disables other calls to hooks.
Therefore, if a hook calls back Lua to execute a function or a chunk,
this execution occurs without any calls to hooks. |