mirror of
https://github.com/1bardesign/batteries.git
synced 2024-11-25 15:14:35 +00:00
[added] :ipairs method for sequence, for convenient inline chaining - should consider making it the __call metamethod probably
This commit is contained in:
parent
80c44f3436
commit
6fae516630
@ -13,6 +13,12 @@ local stable_sort = require(path .. "sort").stable_sort
|
|||||||
|
|
||||||
local sequence = class(table) --proxy missing table fns to tablex api
|
local sequence = class(table) --proxy missing table fns to tablex api
|
||||||
|
|
||||||
|
--iterators as method calls
|
||||||
|
--(no pairs, sequences are ordered)
|
||||||
|
--todo: pico8 like `all`
|
||||||
|
sequence.ipairs = ipairs
|
||||||
|
sequence.iterate = ipairs
|
||||||
|
|
||||||
--upgrade a table into a sequence, or create a new sequence
|
--upgrade a table into a sequence, or create a new sequence
|
||||||
function sequence:new(t)
|
function sequence:new(t)
|
||||||
return self:init(t or {})
|
return self:init(t or {})
|
||||||
|
Loading…
Reference in New Issue
Block a user