Get a name of a item in a table?

Hello! I was looking if I could get the name of a object in a table. Lets say I have a table that is:

local aSimpleTable = {
[“a”] = “Hello!”
}

if I was looping thorugh the table is there a way I can know what object it is? Like it prints “a” as the value of “a” is “Hello!”.

The reason why I want a specific way to get it, is because this value can be anything, the only thing I want is to know what is the objects name and not only the value.

1 Like
for key, value in pairs(aSimpleTable) do
    -- key would be "a", value would be "Hello"
end
4 Likes

Oh I didnt knew this worked with string keys. Thanks!