diff options
author | Matthew Wild <mwild1@gmail.com> | 2013-04-12 00:45:46 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2013-04-12 00:45:46 +0100 |
commit | a9a591ecb9cdfa3e37f2076b2f3c3f23cf320233 (patch) | |
tree | 8ac2aed43241635c96a21040082308e0939ba6e5 | |
parent | 714d8c8d820069449393e1159b605ff8959d3a58 (diff) | |
parent | f9082b6ef0ed929d818033d9962e4a18640ffec7 (diff) | |
download | prosody-a9a591ecb9cdfa3e37f2076b2f3c3f23cf320233.tar.gz prosody-a9a591ecb9cdfa3e37f2076b2f3c3f23cf320233.zip |
Merge 0.9->trunk
-rw-r--r-- | util/iterators.lua | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/util/iterators.lua b/util/iterators.lua index fb89f4a5..1f6aacb8 100644 --- a/util/iterators.lua +++ b/util/iterators.lua @@ -122,6 +122,11 @@ function it.tail(n, f, s, var) --return reverse(head(n, reverse(f, s, var))); end +local function _ripairs_iter(t, key) if key > 1 then return key-1, t[key-1]; end end +function it.ripairs(t) + return _ripairs_iter, t, #t+1; +end + local function _range_iter(max, curr) if curr < max then return curr + 1; end end function it.range(x, y) if not y then x, y = 1, x; end -- Default to 1..x if y not given |