How do I get the Table's Index?

Say, my table is this

local List = {
    ["Points"] = 0

How would I get the “Points” part? I’m trying to get this so I can automate the creation of something.

You can iterate over your table.

for key, value in pairs(List) do


key would be Points.


Wouldn’t “key” be 1 in that case though?

Why would it? Your table has no numerical indices.

Ok, thanks. Honestly, I thought I had to do something really complex.

Is a loop necessary in this case? From what I read, you just want to access the Points index?




You can also assign values to it. I don’t know if I missed something from your post.

1 Like

I mean, I might as well when I’m using it for DataStore2
Edit: You definitely missed it. I want to get the string “Points” from it, not to insert or get the value of it. I’m somewhat competent with Tables.

I absolutely read that wrong. @incapaz is totally correct. Shouldn’t try to respond to things when I’m half asleep. :sweat_smile: