int lua_sethook (lua_State *L, lua_Hook f, int mask, int count);

Sets the debugging hook function.

Argument f is the hook function. mask specifies on which events the hook will be called: it is formed by a bitwise or of the constants LUA_MASKCALL LUA_MASKRET LUA_MASKLINE and LUA_MASKCOUNT The count argument is only meaningful when the mask includes LUA_MASKCOUNT. For each event, the hook is called as explained below:

A hook is disabled by setting mask to zero.