diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2018-11-09 16:40:36 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2018-11-09 16:41:19 -0800 |
| commit | 69aaea030e08e083151aa25b8080eddd0d4c1683 (patch) | |
| tree | 6cd90a65e6828f60cc052c4a1b33a4a4c0d65570 /containers.lua | |
| parent | a2f07415c5284bf94c146cea6eed4a15f171b9ab (diff) | |
No longer passing `tree` to every compile action. Now, you can just
return a LuaCode object, and it will automatically get a source from
`tree` if it didn't already have a source. Plus some fixes/cleanup.
Diffstat (limited to 'containers.lua')
| -rw-r--r-- | containers.lua | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/containers.lua b/containers.lua index 17d37a2..f33c2ff 100644 --- a/containers.lua +++ b/containers.lua @@ -210,19 +210,21 @@ local _list_mt = { end, from_1_to = function(self, start, stop) local n = #self - if n < 0 then + if start < 0 then start = (n + 1 - start) end - if n < 0 then + if stop < 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 + return List((function() + 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)()) end }, __newindex = function(self, k, v) |
