2,875
edits
(Rename toLookup to groupBy) |
(Add custom iterator) |
||
Line 5: | Line 5: | ||
function funlist.new(tbl) | function funlist.new(tbl) | ||
assert(type(tbl) == 'table') | assert(type(tbl) == 'table') | ||
local self = setmetatable({}, funlist) | local self = setmetatable({}, { | ||
__index = funlist, | |||
__pairs = function(self) return pairs(self.mytable) end, | |||
__ipairs = function(self) return ipairs(self.mytable) end | |||
}) | |||
self.mytable = tbl | self.mytable = tbl | ||
self.sortSelectors = {} | self.sortSelectors = {} |
edits