How do I find the name of something in a dictionary?

Let’s say I’m making a for loop that loops through a dictionary. How do I find the name of something in that dictionary?

For example:

local dictionary = {
    ["Player1"] = 219
    ["Player2"] = 285
    ["Player3"] = 295
    ["Player4"] = 188
}

for i, v in pairs(dictionary) do
print(???)--How would I find the name player1, player2, etc? I tried doing v, but it only prints out the number it is(as in order). Like 1, 2, 3, etc.
end

You should be able to achieve this by using the 'i' variable. The 'v' variable is the value at the index (i).

2 Likes

Ohhhhh, oops, how did I not think of that? Thanks!

1 Like

By the way I see you everywhere I go lol

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.