@@ -34,7 +34,7 @@ struct CLuaFunctionParser<ErrorOnFailure, Func>
3434 using param = typename is_variant<T>::param1_t ;
3535 if (accumulator.length () == 0 )
3636 accumulator = typeToName<param>();
37- else
37+ else
3838 accumulator += " /" + typeToName<param>();
3939
4040 if constexpr (is_variant<T>::count != 1 )
@@ -69,12 +69,13 @@ struct CLuaFunctionParser<ErrorOnFailure, Func>
6969 else if constexpr (is_variant<T>::value)
7070 {
7171 SString strTypes;
72- typeToNameVariant<T>(strTypes);
72+ typeToNameVariant<T>(strTypes);
7373 return strTypes;
7474 }
75-
7675 else if constexpr (std::is_pointer_v<T> && std::is_class_v<std::remove_pointer_t <T>>)
7776 return GetClassTypeName ((T)0 );
77+ else if constexpr (std::is_same_v<T, dummy_type>)
78+ return " " ;
7879 }
7980
8081 static SString ResolveParameter (lua_State* L, std::size_t index)
@@ -215,6 +216,11 @@ struct CLuaFunctionParser<ErrorOnFailure, Func>
215216 // and can be fetched from a userdata
216217 if constexpr (std::is_pointer_v<T> && std::is_class_v<std::remove_pointer_t <T>>)
217218 return iArgument == LUA_TUSERDATA || iArgument == LUA_TLIGHTUSERDATA;
219+
220+ // dummy type is used as overload extension if one overload has fewer arguments
221+ // thus it is only allowed if there are no further args on the Lua side
222+ if constexpr (std::is_same_v<T, dummy_type>)
223+ return iArgument == LUA_TNONE;
218224 }
219225
220226 // Special PopUnsafe for variants
@@ -249,10 +255,13 @@ struct CLuaFunctionParser<ErrorOnFailure, Func>
249255 inline T PopUnsafe (lua_State* L, std::size_t & index)
250256 {
251257 // Expect no change in stack size
252- LUA_STACK_EXPECT (0 );
258+ LUA_STACK_EXPECT (0 );
259+ // the dummy type is not read from Lua
260+ if constexpr (std::is_same_v<T, dummy_type>)
261+ return dummy_type{};
253262 // trivial types are directly popped
254- if constexpr (std::is_same_v<T, std::string> || std::is_same_v<T, int > || std::is_same_v<T, float > || std::is_same_v<T, double > ||
255- std::is_same_v<T, short > || std::is_same_v<T, unsigned int > || std::is_same_v<T, unsigned short > || std::is_same_v<T, bool >)
263+ else if constexpr (std::is_same_v<T, std::string> || std::is_same_v<T, int > || std::is_same_v<T, float > || std::is_same_v<T, double > ||
264+ std::is_same_v<T, short > || std::is_same_v<T, unsigned int > || std::is_same_v<T, unsigned short > || std::is_same_v<T, bool >)
256265 return lua::PopTrivial<T>(L, index);
257266 else if constexpr (std::is_enum_v<T>)
258267 {
0 commit comments