2,875
edits
No edit summary |
(Delayed func test) |
||
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 220: | Line 221: | ||
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 229: | Line 240: | ||
local val = selector(v) | local val = selector(v) | ||
assert(val) | assert(val) | ||
table.insert(result, | table.insert(result, val) | ||
end | end | ||
self.mytable = result | self.mytable = result |
edits