diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2019-01-30 15:19:38 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2019-01-30 15:19:43 -0800 |
| commit | b714a55ec09fa4c7b2053e5b9a29ad7d69b2486a (patch) | |
| tree | bd98dc4b7b0c19bbfcdac65dcd81d923e4e5694e /containers.lua | |
| parent | bc41cc3a244bf47679d1c47d17006a2aa7356bc8 (diff) | |
Added 'reversed' method for lists.
Diffstat (limited to 'containers.lua')
| -rw-r--r-- | containers.lua | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/containers.lua b/containers.lua index 8f34e73..e706831 100644 --- a/containers.lua +++ b/containers.lua @@ -225,6 +225,17 @@ local _list_mt = { end return _accum_0 end)()) + end, + reversed = function(self) + return List((function() + local _accum_0 = { } + local _len_0 = 1 + for i = #self, 1, -1 do + _accum_0[_len_0] = self[i] + _len_0 = _len_0 + 1 + end + return _accum_0 + end)()) end }, __newindex = function(self, k, v) |
