From 6fae516630278e825135b07328e5f729d585c9c9 Mon Sep 17 00:00:00 2001 From: Max Cahill <1bardesign@gmail.com> Date: Thu, 13 May 2021 15:03:06 +1000 Subject: [PATCH] [added] :ipairs method for sequence, for convenient inline chaining - should consider making it the __call metamethod probably --- sequence.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sequence.lua b/sequence.lua index 6964e83..36af9b9 100644 --- a/sequence.lua +++ b/sequence.lua @@ -13,6 +13,12 @@ local stable_sort = require(path .. "sort").stable_sort 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 function sequence:new(t) return self:init(t or {})