Skip to content

Commit 8c2f95a

Browse files
authored
Appendum - CLuaFunctionParser refactor (#3494) (#3574)
1 parent 934c1d6 commit 8c2f95a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ class LuaFunctionError
3333
constexpr bool IsWarning() const noexcept { return m_bWarning; }
3434
};
3535

36+
using LuaVarArgs = std::optional<CLuaArguments>;
37+
3638
struct CLuaFunctionParserBase
3739
{
3840
// iIndex is passed around by reference
@@ -74,6 +76,8 @@ struct CLuaFunctionParserBase
7476
}
7577
else if constexpr (std::is_same_v<T, CLuaArgument>)
7678
return "value";
79+
else if constexpr (std::is_same_v<T, CLuaArguments>)
80+
return "values";
7781
else if constexpr (is_2specialization<T, std::vector>::value)
7882
return "table";
7983
else if constexpr (is_5specialization<T, std::unordered_map>::value)
@@ -219,6 +223,9 @@ struct CLuaFunctionParserBase
219223
else if constexpr (std::is_same_v<T, CLuaArgument>)
220224
return iArgument != LUA_TNONE;
221225

226+
else if constexpr (std::is_same_v<T, CLuaArguments>)
227+
return iArgument != LUA_TNONE;
228+
222229
// All color classes are read as a single tocolor number
223230
// Do not be tempted to change this to is_base_of<SColor, T>
224231
// SColorARGB etc are only **constructors** for SColor!
@@ -651,6 +658,12 @@ struct CLuaFunctionParserBase
651658
argument.Read(L, index++);
652659
return argument;
653660
}
661+
else if constexpr (std::is_same_v<T, CLuaArguments>)
662+
{
663+
CLuaArguments argument;
664+
argument.ReadArguments(L, index);
665+
return argument;
666+
}
654667
else if constexpr (std::is_same_v<T, std::monostate>)
655668
{
656669
return T{};

0 commit comments

Comments
 (0)