TMap access elements by index

I’m using a map to count votes for a voting system, so the vote string is the key, and the vote count is the value.

I sort the map to get the top vote, but now how do I access the top vote? A hack way of doing it I came up with was doing a for loop and breaking on the first iteration.

But what if there’s a tie? I need to check if the second element and first element have the same count?

I need to be able to access elements in ordered indices. Can I do that? Or is there something else that can help me?

Convert keys/values to an array and you will be able to access them with index.

GenerateKeyArray and GenerateValueArray keywords.

You probably meant to use the GenerateKeyArray() function. GenerateValueArray() as used in your example would output an array of floats instead.