Better error handling in 'Call a Lua Function' k2node
This commit is contained in:
@@ -223,12 +223,26 @@ void UlxLuaCallLibrary::LuaCallInvoke(UObject *context, AActor *place)
|
||||
}
|
||||
|
||||
|
||||
void UlxLuaCallLibrary::LuaCallProbe(UObject *context, AActor *place)
|
||||
bool UlxLuaCallLibrary::LuaCallProbe(UObject *context, AActor *place)
|
||||
{
|
||||
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(context);
|
||||
FlxStreamBuffer &sb = mode->LuaCallGetBuffer();
|
||||
if (NotInitialized(sb)) return;
|
||||
if (NotInitialized(sb)) return false;
|
||||
mode->LuaCallEnd(InvocationKind::LUA_PROBE, place);
|
||||
FlxStreamBuffer &result = mode->LuaCallGetResult();
|
||||
SimpleDynamicTag tag = result.read_simple_dynamic_tag();
|
||||
if (tag != SimpleDynamicTag::STRING)
|
||||
{
|
||||
UE_LOG(LogLuprexIntegration, Error, TEXT("corruption in lua_probe"));
|
||||
return false;
|
||||
}
|
||||
FString ErrorMessage = result.read_fstring();
|
||||
if (!ErrorMessage.IsEmpty())
|
||||
{
|
||||
UE_LOG(LogLuprex, Error, TEXT("%s"), *ErrorMessage);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
UlxLuaValues *UlxLuaCallLibrary::LuaCallGetRest(UObject *context)
|
||||
|
||||
Reference in New Issue
Block a user