Updated NetArchiveHook to lua_hooklib.c

Fixes I_Assert failure crash due to hooks working differently now.
This commit is contained in:
Yukita Mayako 2016-03-03 17:07:05 -05:00
parent fc35c8557e
commit 0b704ba618
2 changed files with 27 additions and 25 deletions

View file

@ -768,4 +768,28 @@ boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source)
return hooked;
}
void LUAh_NetArchiveHook(lua_CFunction archFunc)
{
hook_p hookp;
if (!gL || !(hooksAvailable[hook_NetVars/8] & (1<<(hook_NetVars%8))))
return;
// stack: tables
I_Assert(lua_gettop(gL) > 0);
I_Assert(lua_istable(gL, -1));
for (hookp = roothook; hookp; hookp = hookp->next)
if (hookp->type == hook_NetVars)
{
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
lua_gettable(gL, LUA_REGISTRYINDEX);
lua_pushvalue(gL, -2); // tables
LUA_Call(gL, 1);
}
// pop tables
lua_pop(gL, 1);
}
#endif