/* Call hook function registered at hook table for the current thread (if there is one)  */
static void hookf(lua_State *L, lua_Debug *ar)
/* Call hook function registered at hook table for the current thread (if there is one)  */
static void hookf(lua_State *L, lua_Debug *ar)
{"call", "return", "line", "count", "tail call"};
  lua_rawgetp(L, LUA_REGISTRYINDEX, &HOOKKEY);
  lua_pushthread(L);
  if (lua_rawget(L, -2) == LUA_TFUNCTION) {
    lua_pushstring(L, hooknames[(int)ar->event]);
    if (ar->currentline >= 0)
      lua_pushinteger(L, ar->currentline);
    else lua_pushnil(L);
    lua_assert(lua_getinfo(L, "lS", ar));
    lua_call(L, 2, 0);
  }
}