Anonymous

Module:FunList: Difference between revisions

From Melvor Idle
Undo revision 77686 by Ricewind (talk)
(Undo revision 77687 by Ricewind (talk))
Tag: Undo
(Undo revision 77686 by Ricewind (talk))
Tag: Undo
Line 9: Line 9:
     local self = setmetatable({}, funlist)
     local self = setmetatable({}, funlist)
self.mytable = tbl
self.mytable = tbl
self.delayedFuncs = {}
return self
return self
end
end
Line 221: Line 220:
table.sort(self.mytable, sortFunc)
table.sort(self.mytable, sortFunc)
return self
return self
end
function funlist:Nselect(selector)
assert(selector)
local delayedFunc = function(k, v, func)
local val = selector(v)
assert(val)
return val
end
table.insert(self.delayedFuncs, delayedFunc)
end
end


Line 240: Line 229:
     local val = selector(v)
     local val = selector(v)
     assert(val)
     assert(val)
         table.insert(result, val)
         table.insert(result, selector(v))
     end
     end
     self.mytable = result
     self.mytable = result
2,875

edits