RealDocs

UBlueprintMapLibrary::Map_GetLastIndex

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

Description

Returns the highest valid index into the map's internal storage, for use with Map_GetKeyValueByIndex when iterating by index.

Caveats & Gotchas

  • Not the same as Map_Length() - 1 once entries have been removed, because TMap's sparse storage can leave gaps below the last valid slot.
  • For straightforward iteration, Map_Keys or Map_Values combined with a For Each loop is simpler and avoids having to handle gaps yourself.

Signature

static int32 Map_GetLastIndex(const TMap<int32, int32>& TargetMap);

Parameters

Name Type Description Default
TargetMap const TMap<int32, int32>& Wildcard placeholder for the map in question.

Return Type

int32

Example

Bound a manual index loop C++
// By-index iteration is a Blueprint-only pattern; in native C++ just range-for the TMap:
for (const auto& Pair : Scores)
{
    // no need to compute a last valid 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.