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
......
else if (retType.isAssignableFrom(Number.class))
{
// Checks all possibilities of number types
if (retType.isAssignableFrom(Integer.class))
{
return new Integer(db.intValue());
}
else if (retType.isAssignableFrom(Long.class))
{
return new Long(db.longValue());
}
else if (retType.isAssignableFrom(Float.class))
{
return new Float(db.floatValue());
}
else if (retType.isAssignableFrom(Double.class))
{
return db;
}
else if (retType.isAssignableFrom(Byte.class))
{
return new Byte(db.byteValue());
}
else if (retType.isAssignableFrom(Short.class))
{
return new Short(db.shortValue());
}
}
在实现接口逻辑的lua函数里如果返回数字,而java层函数返回值声明不是基本类型,那么将会被强制转化为Integer,原因在于LuaState里convertLuaNumber的实现逻辑存在问题
这一系列isAssignableFrom的判断应该是写反了,否则如果retType是Object,那么所有判断都是符合的,但实际上总是运行第一个判断逻辑,这与上面实际遇到的问题是一致的
The text was updated successfully, but these errors were encountered: