RosettaCodeData/Task/Collections/Pluto/collections.pluto

14 lines
327 B
Plaintext

local fmt = require "fmt"
local array = {1, 2, 3, 4}
array:insert(5)
fmt.lprint(array)
print(#array)
print(array[2]) -- note that array indexing normally starts at 1
print()
local map = { a = 97, b = 98, d = 100, e = 101}
map["c"] = 99
print(fmt.hwrite(map)) -- note map order not guaranteed
print(map:size())
print(map["b"])