How to make Blueprint function return more than one value

Hi, sorry noob unreal c++ question but I trying to get my own blueprint function from c++ return an array and a Boolean but I can get only one value on return. I read somewhere that I could use a struct as return value but my question is why the following code :

(header file)
UFUNCTION(BlueprintPure, Category = "file")	
static bool FileLoadStringArray(FString FileNameA,  TArray<FString>& SaveTextA);

(cpp file)
bool UMyBlueprintFunctionLibrary::FileLoadStringArray(FString FileNameA, TArray<FString>& StringArrayResult)
    return FFileHelper::LoadFileToStringArray(StringArrayResult, *(FPaths::GameDir() + FileNameA));

return this:


I have been checking the source code and it is not using any struct but still is returning a boolean and an array.

On Line 9, the first token is “bool” (declared in the header Line 4 as “static bool”). That is what your function will return. On Line 11, your function returns whatever LoadFileToStringArray returns, which is a (static) bool.

In LoadFileToStringArray, the StringArrayResult is passed by reference. That’s what you want to extract.

The SaveTextA that you pass to the function should be changed as it is passed by reference. It won’t get returned, but it should be updated for its next use after the function.

Also, two things:

  1. the BP node doesn’t seem to match your function signature.
  2. I find it helpful to match the names of the function parameters in the header and cpp files.