Print the indexes in a table?

How can I print the indexes in a table?

For example, I want to print “milk” and “eggs” found in the for loop.



tbl = {}
tbl["milk"] = 1
tbl["eggs"] = 2

for k,v in pairs ( tbl ) do

print( tbl:Index() ) -- Need help.

end


print(k) will do the think you’re looking for here

[lua]for key, value in pairs(table) do
print(key)
print(value)
end[/lua]

And I believe those are called Keys

Ok, thanks. It’s so obvious now.