Skip to content

Commit

Permalink
修复Android平台下LuaTuple返回基础类型值不正确问题
Browse files Browse the repository at this point in the history
  • Loading branch information
vimfung committed Feb 19, 2019
1 parent 4766fd9 commit 3b916c3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,19 @@ private void setObjectValue (Object value)
{
if (value != null)
{
if (value instanceof Integer)
if (value instanceof Character)
{
setLongValue(Long.valueOf((Character)value));
}
else if (value instanceof Byte)
{
setLongValue(Long.valueOf((Byte)value));
}
else if (value instanceof Short)
{
setLongValue(Long.valueOf((Short)value));
}
else if (value instanceof Integer)
{
setLongValue(Long.valueOf((Integer)value));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ LuaValue* LuaJavaConverter::convertToLuaValueByJObject(JNIEnv *env, LuaContext *
jmethodID intValueMethodId = env -> GetMethodID(LuaJavaType::integerClass(env), "intValue", "()I");
value = new LuaValue((long)env -> CallIntMethod(object, intValueMethodId));
}
else if (env -> IsInstanceOf(object, LuaJavaType::longClass(env)) == JNI_TRUE)
{
//Long类型
jmethodID valueMethodId = env -> GetMethodID(LuaJavaType::longClass(env), "longValue", "()J");
value = new LuaValue((long)env -> CallLongMethod(object, valueMethodId));
}
else if (env -> IsInstanceOf(object, LuaJavaType::doubleClass(env)) == JNI_TRUE)
{
//Double类型
Expand Down

0 comments on commit 3b916c3

Please sign in to comment.