Skip to main content

LI PASS Lua Error Event Callback Information (LILuaErrorObserver)

If you are using the Unity engine, see Unity SDK's LILuaErrorObserver.

Register the LI PASS Lua Error event's callback, the game needs to handle the callback function.The callback will be triggered when an error occurs at the Lua layer.

note

It is strongly advised to register in the application startup function.Supported from LI PASS V1.06 onwards.

Function Definition

FLILuaErrorDelegate& GetLuaErrorDelegate();

Code Sample

// Add callback
FDelegateHandle LILuaErrorObserver;
LILuaErrorObserver = ULevelInfiniteAPI::GetLuaErrorDelegate().AddUObject(this, &ULevelInfiniteWindow::OnLILuaError_Callback);
// Process callback result from LILuaErrorObserver
void ULevelInfiniteWindow::OnLILuaError_Callback(FString ErrorStr)
{
FString errorInfo = ErrorStr;
UE_LOG(LogTemp, Warning, TEXT("ULevelInfiniteWindow OnLILuaError_Callback %s"), *errorInfo);
AppendResultText(FString::Printf(TEXT("ULevelInfiniteWindow OnLILuaError_Callback %s"), *errorInfo));
}
// Remove callback
ULevelInfiniteAPI::GetLuaErrorDelegate().Remove(LILuaErrorObserver);