Skip to content

Commit ca877d3

Browse files
authored
Allow nested Lua arrays / maps (#4180)
1 parent c8fbacd commit ca877d3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Shared/mods/deathmatch/logic/lua/CLuaFunctionParser.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ struct CLuaFunctionParserBase
455455
using param = typename is_2specialization<T, std::vector>::param1_t;
456456
T vecData;
457457
lua_pushnil(L); /* first key */
458-
while (lua_next(L, index) != 0)
458+
while (lua_next(L, index < 0 ? (index - 1) : index) != 0)
459459
{
460460
if (!TypeMatch<param>(L, -1))
461461
{
@@ -477,7 +477,7 @@ struct CLuaFunctionParserBase
477477
using value_t = typename is_5specialization<T, std::unordered_map>::param2_t;
478478
T map;
479479
lua_pushnil(L); /* first key */
480-
while (lua_next(L, index) != 0)
480+
while (lua_next(L, index < 0 ? (index - 1) : index) != 0)
481481
{
482482
if (!TypeMatch<value_t>(L, -1) || !TypeMatch<key_t>(L, -2))
483483
{

0 commit comments

Comments
 (0)