RealDocs

UBlueprintSetLibrary::Set_GetLastIndex

function Engine Blueprint Since unknown
#include "Kismet/BlueprintSetLibrary.h"
Access: public Specifiers: staticBlueprintPureCustomThunk

Description

Returns the highest valid index into the set — Set_Length minus one — for use with Set_GetItemByIndex.

Caveats & Gotchas

  • Returns -1 for an empty set rather than 0; check for this before using the result to drive a loop bound.
  • Exists mainly to pair with Set_GetItemByIndex for manual iteration; a ForEachLoop node is simpler for most Blueprint use cases.

Signature

static int32 Set_GetLastIndex(const TSet<int32>& TargetSet);

Parameters

Name Type Description Default
TargetSet const TSet<int32>& Wildcard placeholder for the set in question.

Return Type

int32

Example

Bounds-check before indexing C++
TSet<int32> Values = {10, 20, 30};
const int32 LastIndex = Values.Num() - 1; // native equivalent of Set_GetLastIndex
if (LastIndex >= 0)
{
	// safe to index
}

Version History

Introduced in: unknown

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.