mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-11-10 23:31:50 +00:00
Fix Lua panic when archiving a table element with an userdata key
This commit is contained in:
parent
87b1246b58
commit
aefe06e2ef
1 changed files with 4 additions and 3 deletions
|
@ -478,10 +478,10 @@ static const struct {
|
|||
{NULL, ARCH_NULL}
|
||||
};
|
||||
|
||||
static UINT8 GetUserdataArchType(void)
|
||||
static UINT8 GetUserdataArchType(int index)
|
||||
{
|
||||
UINT8 i;
|
||||
lua_getmetatable(gL, -1);
|
||||
lua_getmetatable(gL, index);
|
||||
|
||||
for (i = 0; meta2arch[i].meta; i++)
|
||||
{
|
||||
|
@ -560,7 +560,7 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex)
|
|||
break;
|
||||
}
|
||||
case LUA_TUSERDATA:
|
||||
switch (GetUserdataArchType())
|
||||
switch (GetUserdataArchType(myindex))
|
||||
{
|
||||
case ARCH_MOBJINFO:
|
||||
{
|
||||
|
@ -777,6 +777,7 @@ static void ArchiveTables(void)
|
|||
CONS_Alert(CONS_ERROR, "Type of value for table %d entry '%s' (%s) could not be archived!\n", i, lua_tostring(gL, -1), luaL_typename(gL, -1));
|
||||
lua_pop(gL, 1);
|
||||
}
|
||||
|
||||
lua_pop(gL, 1);
|
||||
}
|
||||
lua_pop(gL, 1);
|
||||
|
|
Loading…
Reference in a new issue