Skip to content

Commit

Permalink
优化Android和Unity3D下的抛出Lua异常操作
Browse files Browse the repository at this point in the history
  • Loading branch information
vimfung committed Mar 12, 2019
1 parent 4516dea commit 38b6db7
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ public void onException (LuaExceptionHandler handler)
public void raiseException (String message) throws Error
{
LuaNativeUtil.raiseException(this, message);
throw new Error(message);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ JNIEXPORT void JNICALL Java_cn_vimfung_luascriptcore_LuaNativeUtil_raiseExceptio
if (context != NULL)
{
const char *messageCStr = env->GetStringUTFChars(message, 0);
context -> getCurrentSession() -> reportLuaException(messageCStr);
context -> raiseException(messageCStr);
env -> ReleaseStringUTFChars(message, messageCStr);
}
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Unity3D/UnityCommon/LuaScriptCoreForUnity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ extern "C" {
LuaContext *context = dynamic_cast<LuaContext *>(LuaObjectManager::SharedInstance() -> getObject(nativeContextId));
if (context != NULL && message != NULL)
{
context -> getCurrentSession() -> reportLuaException(message);
context -> raiseException(message);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ public void onException(LuaExceptionHandler handler)
public void raiseException(string message)
{
NativeUtils.raiseException (_nativeObjectId, message);
throw new Exception (message);
}

/// <summary>
Expand Down

0 comments on commit 38b6db7

Please sign in to comment.