You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Similar problem for C++ function void bar(int8_t i) called with foo(1000)
Proposed fix:
lua_Number num = lua_type_traits<lua_Number>::get(l, index);
if(num < std::numeric_limits<get_type>::min() || num > std::numeric_limits<get_type>::max())
throw LuaTypeMismatch();
return static_cast<get_type>(num);
Probably extract the check to a standalone function as it is also required at other places (e.g. opt and for Lua 5.3)
Not sure if this breaks the contract of strictCheckType as it may be possible, that a value passes the check (just from checking types) but fails to be gotten as it is outside the range.
The text was updated successfully, but these errors were encountered:
In Lua numbers are essentially
double
s. So the following is valid in lua:foo(-1)
If this is bound to a C++ function
void foo(unsigned i)
it silently does the wrong thing.This is caused by the unchecked cast at:
kaguya/include/kaguya/type.hpp
Line 520 in 38ca7e1
Similar problem for C++ function
void bar(int8_t i)
called withfoo(1000)
Proposed fix:
Probably extract the check to a standalone function as it is also required at other places (e.g. opt and for Lua 5.3)
Not sure if this breaks the contract of
strictCheckType
as it may be possible, that a value passes the check (just from checking types) but fails to be gotten as it is outside the range.The text was updated successfully, but these errors were encountered: