mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-27 03:30:50 +00:00
Fix bad logic in LUAh_NetArchiveHook rewrite...
Argh, I knew I was forgetting something! archFunc is the argument to be passed to the hooks, not tables!
This commit is contained in:
parent
9d6e75ae4f
commit
b368936b03
1 changed files with 7 additions and 1 deletions
|
@ -779,15 +779,21 @@ void LUAh_NetArchiveHook(lua_CFunction archFunc)
|
||||||
I_Assert(lua_gettop(gL) > 0);
|
I_Assert(lua_gettop(gL) > 0);
|
||||||
I_Assert(lua_istable(gL, -1));
|
I_Assert(lua_istable(gL, -1));
|
||||||
|
|
||||||
|
// tables becomes an upvalue of archFunc
|
||||||
|
lua_pushvalue(gL, -1);
|
||||||
|
lua_pushcclosure(gL, archFunc, 1);
|
||||||
|
// stack: tables, archFunc
|
||||||
|
|
||||||
for (hookp = roothook; hookp; hookp = hookp->next)
|
for (hookp = roothook; hookp; hookp = hookp->next)
|
||||||
if (hookp->type == hook_NetVars)
|
if (hookp->type == hook_NetVars)
|
||||||
{
|
{
|
||||||
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
|
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
|
||||||
lua_gettable(gL, LUA_REGISTRYINDEX);
|
lua_gettable(gL, LUA_REGISTRYINDEX);
|
||||||
lua_pushvalue(gL, -2); // tables
|
lua_pushvalue(gL, -2); // archFunc
|
||||||
LUA_Call(gL, 1);
|
LUA_Call(gL, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lua_pop(gL, 1); // pop archFunc
|
||||||
// stack: tables
|
// stack: tables
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue