To go about in more detail as to what Lyqyd previously stated:
The default keys in tables are in numerical order, we can obviously change that:
Default Table:
local foo = {"cool", "extremist", "awesome"}
Altered table:
local foo = {["Cloudy"] = "cool", ["Lyqyd"] = "extremist", ["Dan200"] ="awesome"}
So before we changed the keys in table 'foo' they were assigned as 1, 2, and 3. Now the first key is "Cloudy", the second key is "Lyqyd", and the last key is "Dan200". N
ow this is all nice to know, but this is not your direct question; onward we go.
Now let's talk about elements of a table. In the above table, 'foo', we have assigned three keys: Cloudy, Lyqyd, and Dan200. The elements of these keys are as follows: cool, extremist, and awesome. Now, lets say we want to only show people who are 'cool'. We can iterate through the table and use a conditional statement to match us with people who are 'cool':
for k, v in pairs(foo) do
if v == "cool" then
write(k.." is cool")
else
write("Y U NO COOL!")
end
end
Had there been no elements with a value of "cool", it would write "Y U NO COOL!". This is a very small example of the power of tables and how beneficial they are to use. In conclusion, tables are your friends; use them and abuse them.