@@ -46,11 +46,10 @@ struct CLuaFunctionParserBase
46
46
{
47
47
if constexpr (std::is_same_v<T, std::string> || std::is_same_v<T, std::string_view>)
48
48
return " string" ;
49
- else if constexpr (std::is_same_v<T, int > || std::is_same_v<T, float > || std::is_same_v<T, double > || std::is_same_v<T, short > ||
50
- std::is_same_v<T, unsigned int > || std::is_same_v<T, unsigned short >)
51
- return " number" ;
52
49
else if constexpr (std::is_same_v<T, bool >)
53
50
return " boolean" ;
51
+ else if constexpr (std::is_arithmetic_v<T>)
52
+ return " number" ;
54
53
else if constexpr (std::is_enum_v<T>)
55
54
return " enum" ;
56
55
else if constexpr (is_specialization<T, std::optional>::value)
@@ -188,11 +187,10 @@ struct CLuaFunctionParserBase
188
187
// primitive types
189
188
if constexpr (std::is_same_v<T, std::string> || std::is_same_v<T, std::string_view>)
190
189
return (iArgument == LUA_TSTRING || iArgument == LUA_TNUMBER);
191
- if constexpr (std::is_same_v<T, int > || std::is_same_v<T, float > || std::is_same_v<T, double > || std::is_same_v<T, short > ||
192
- std::is_same_v<T, unsigned int > || std::is_same_v<T, unsigned short >)
193
- return lua_isnumber (L, index);
194
190
if constexpr (std::is_same_v<T, bool >)
195
191
return (iArgument == LUA_TBOOLEAN);
192
+ if constexpr (std::is_arithmetic_v<T>)
193
+ return lua_isnumber (L, index);
196
194
197
195
// Advanced types
198
196
// Enums are represented as strings to Lua
@@ -336,8 +334,7 @@ struct CLuaFunctionParserBase
336
334
if constexpr (std::is_same_v<T, dummy_type>)
337
335
return dummy_type{};
338
336
// primitive types are directly popped
339
- else if constexpr (std::is_same_v<T, std::string> || std::is_same_v<T, int > || std::is_same_v<T, short > || std::is_same_v<T, bool > ||
340
- std::is_same_v<T, unsigned int > || std::is_same_v<T, unsigned short > || std::is_same_v<T, std::string_view>)
337
+ else if constexpr (std::is_same_v<T, std::string> || std::is_same_v<T, std::string_view> || std::is_integral_v<T>)
341
338
return lua::PopPrimitive<T>(L, index);
342
339
// floats/doubles may not be NaN
343
340
else if constexpr (std::is_same_v<T, float > || std::is_same_v<T, double >)
0 commit comments