Fixed ScriptValue::to() for int and float types.
This commit is contained in:
parent
017bba89e4
commit
7dcdf2df22
@ -233,7 +233,7 @@ public:
|
||||
}
|
||||
else if constexpr (std::is_integral_v<type_t>)
|
||||
{
|
||||
return toInt().then([](script_int_t val) { return static_cast<type_t>(val); });
|
||||
return toInt().then([](script_int_t val) -> Optional<std::decay_t<T>> { return static_cast<type_t>(val); });
|
||||
}
|
||||
else if constexpr (std::is_same_v<type_t, script_float_t>)
|
||||
{
|
||||
@ -241,7 +241,7 @@ public:
|
||||
}
|
||||
else if constexpr (std::is_floating_point_v<type_t>)
|
||||
{
|
||||
return toFloat().then([](script_float_t val) { return static_cast<type_t>(val); });
|
||||
return toFloat().then([](script_float_t val) -> Optional<std::decay_t<T>> { return static_cast<type_t>(val); });
|
||||
}
|
||||
else if constexpr (std::is_same_v<type_t, std::string>)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user