diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2018-09-26 12:45:08 -0700 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2018-09-26 12:45:19 -0700 |
| commit | 692fae5416ce1f2702b599ffb27b2e3d2235eba7 (patch) | |
| tree | 12ae256ef5606251bc013935390fdef7e737d79d /containers.moon | |
| parent | 28d0792e69bbb9c467c616eb3dc89a60085c35f2 (diff) | |
Incremental fixes and more nomnom ports.
Diffstat (limited to 'containers.moon')
| -rw-r--r-- | containers.moon | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/containers.moon b/containers.moon index 039a4ea..8a7d7fa 100644 --- a/containers.moon +++ b/containers.moon @@ -76,6 +76,11 @@ _list_mt = if x == item return i return nil + slice_1_to_2: (start, stop)=> + n = #@ + start = (n+1-start) if n < 0 + stop = (n+1-stop) if n < 0 + return [@[i] for i=start,stop] -- TODO: remove this safety check to get better performance? __newindex: (k,v)=> assert type(k) == 'number', "List indices must be numbers" |
