Skip to main content

LILuaErrorObserver

If you were looking for the method for use with Unity, see LILuaErrorObserver for Unity SDK.

The callback of LI PASS Lua Error event, the game needs to process the callback function. When a Lua error occurs, the callback is triggered.

note

It is strongly recommended to incorporate the callback within the startup function of the game. Supported in LI PASS V1.06 and later versions.

Function definition

FLILuaErrorDelegate& GetLuaErrorDelegate();

Code sample

// Add callbacks
FDelegateHandle LILuaErrorObserver;
LILuaErrorObserver = ULevelInfiniteAPI::GetLuaErrorDelegate().AddUObject(this, &ULevelInfiniteWindow::OnLILuaError_Callback);
// Handle LILuaErrorObserver callback result
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 callbacks
ULevelInfiniteAPI::GetLuaErrorDelegate().Remove(LILuaErrorObserver);