Module:FunList: Difference between revisions

Add custom iterator
(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')
    assert(tbl ~= nil)


     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 = {}
2,875

edits