aboutsummaryrefslogtreecommitdiff
path: root/containers.lua
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2018-09-26 12:45:08 -0700
committerBruce Hill <bruce@bruce-hill.com>2018-09-26 12:45:19 -0700
commit692fae5416ce1f2702b599ffb27b2e3d2235eba7 (patch)
tree12ae256ef5606251bc013935390fdef7e737d79d /containers.lua
parent28d0792e69bbb9c467c616eb3dc89a60085c35f2 (diff)
Incremental fixes and more nomnom ports.
Diffstat (limited to 'containers.lua')
-rw-r--r--containers.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/containers.lua b/containers.lua
index d31c786..682932f 100644
--- a/containers.lua
+++ b/containers.lua
@@ -192,6 +192,22 @@ local _list_mt = {
end
end
return nil
+ end,
+ slice_1_to_2 = function(self, start, stop)
+ local n = #self
+ if n < 0 then
+ start = (n + 1 - start)
+ end
+ if n < 0 then
+ stop = (n + 1 - stop)
+ end
+ local _accum_0 = { }
+ local _len_0 = 1
+ for i = start, stop do
+ _accum_0[_len_0] = self[i]
+ _len_0 = _len_0 + 1
+ end
+ return _accum_0
end
},
__newindex = function(self, k, v)