1 2 3 4 5 6 7 8 9 10 11 12 13
local mt1 = { __index = { pie = "yummy" } } local mt2 = { __index = function(i) return i == "pie" and "yummy" end } local t1 = setmetatable({}, mt1) local t2 = setmetatable({}, mt2) print(next(t1)) print(next(t2))
1 2
nil nil