Data update
This commit is contained in:
parent
4d5544505c
commit
4924dd0264
3073 changed files with 55820 additions and 4408 deletions
|
|
@ -0,0 +1,25 @@
|
|||
-- Create a map of key, value pairs.
|
||||
local planets = {
|
||||
Mercury = 1,
|
||||
Venus = 2,
|
||||
Earth = 3,
|
||||
Mars = 4,
|
||||
Jupiter = 5,
|
||||
Saturn = 6,
|
||||
Uranus = 7,
|
||||
Neptune = 8,
|
||||
Pluto = 9
|
||||
}
|
||||
|
||||
-- Print it
|
||||
-- Note that order is not guaranteed.
|
||||
for k, v in planets do print(k, v) end
|
||||
print()
|
||||
|
||||
-- Create a new one by inverting the key, value pairs.
|
||||
local planets2 = planets:invert()
|
||||
|
||||
-- Print it.
|
||||
-- Now treated as an array with indices 1 to 9
|
||||
-- which guarantees order.
|
||||
for k, v in planets2 do print($"{k} {v}") end
|
||||
Loading…
Add table
Add a link
Reference in a new issue