Changeset

5469:fcdcc37ffec1

Merge 0.9->trunk
author Matthew Wild <mwild1@gmail.com>
date Fri, 12 Apr 2013 00:45:46 +0100
parents 5467:9b7c919bf238 (current diff) 5468:2660407c3b73 (diff)
children 5473:3db05041c278
files
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/util/iterators.lua	Fri Apr 12 00:32:10 2013 +0100
+++ b/util/iterators.lua	Fri Apr 12 00:45:46 2013 +0100
@@ -122,6 +122,11 @@
 	--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