Static Public Member Functions | List of all members
UBPUtilsArrayLibrary Class Reference

Static Public Member Functions

static bool ArrayHasAny (const TArray< UProperty * > &Array)
 Checks if an array has any elements. More...
 
static bool ArrayIsEmpty (const TArray< UProperty * > &Array)
 Checks if an array does not have any elements. More...
 
static void ArraySample (const TArray< int32 > &Array, int32 &Item)
 Selects a random element from the given array. More...
 
static bool ArrayTryGet (const TArray< int32 > &Array, const int32 Index, int32 &Item)
 Tries to get an element from the array, can fail without throwing an error. More...
 
static TArray< UObject * > ObjectArrayFilter (const TArray< UObject * > &Array, const FObjectArrayFilterDelegate &Callback)
 Filters an array using the given delegate function Filter function signature is UObject* -> bool where the item is retained if the function returns true. More...
 

Member Function Documentation

◆ ArrayHasAny()

bool UBPUtilsArrayLibrary::ArrayHasAny ( const TArray< UProperty * > &  Array)
static

Checks if an array has any elements.

Parameters
ArrayThe array to check
Returns
True if the array has any elements
array-any.png

◆ ArrayIsEmpty()

bool UBPUtilsArrayLibrary::ArrayIsEmpty ( const TArray< UProperty * > &  Array)
static

Checks if an array does not have any elements.

Parameters
ArrayThe array to check
Returns
True if the array does not have any elements
array-empty.png

◆ ArraySample()

void UBPUtilsArrayLibrary::ArraySample ( const TArray< int32 > &  Array,
int32 &  Item 
)
static

Selects a random element from the given array.

Returns NULL if the array is empty.

Parameters
ArrayThe array to sample from
Return values
ItemThe randomly chosen element
array-sample.png

◆ ArrayTryGet()

bool UBPUtilsArrayLibrary::ArrayTryGet ( const TArray< int32 > &  Array,
const int32  Index,
int32 &  Item 
)
static

Tries to get an element from the array, can fail without throwing an error.

Returns NULL if the index is invalid.

Parameters
ArrayThe array to sample from
IndexThe index to try to use
Return values
ItemThe element at that index if valid, or NULL
SuccessTrue if the index was valid
array-tryget.png

◆ ObjectArrayFilter()

TArray< UObject * > UBPUtilsArrayLibrary::ObjectArrayFilter ( const TArray< UObject * > &  Array,
const FObjectArrayFilterDelegate &  Callback 
)
static

Filters an array using the given delegate function Filter function signature is UObject* -> bool where the item is retained if the function returns true.

Parameters
ArrayThe array to sample from
CallbackThe filter function
Returns
New array containing filtered items
array-object-filter.png