How can I print the indexes in a table?
For example, I want to print "milk" and "eggs" found in the for loop.
[CODE]
tbl = {}
tbl["milk"] = 1
tbl["eggs"] = 2
for k,v in pairs ( tbl ) do
print( tbl:Index() ) -- Need help.
end
[/CODE]
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.
Sorry, you need to Log In to post a reply to this thread.