pairs returns the key, value pairs in a table
Code:
self.tab = {
key1 = 1,
key2 = { a=1, b=2 },
key3 = "Hello"
}
for key, value in pairs(self.tab) do
-- This will return over the 3 iterations (in no particular order)
key == "key1", value == 1
key == "key2", value == (pointer to the table)
key == "key3", value == "Hello"
end
You can replace the key, value terms with any names that suit the situation.