projects
/
prosody.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
util.httpstream: Initial commit of the new HTTP parser.
[prosody.git]
/
util
/
iterators.lua
diff --git
a/util/iterators.lua
b/util/iterators.lua
index 318c1a96b8fad3b45f1d7111ef130d98ab34e8f0..cc50482721b485b5ecce731c820813b0ad203284 100644
(file)
--- a/
util/iterators.lua
+++ b/
util/iterators.lua
@@
-90,6
+90,15
@@
function head(n, f, s, var)
end, s;
end
end, s;
end
+-- Skip the first n items an iterator returns
+function skip(n, f, s, var)
+ for i=1,n do
+ var = f(s, var);
+ end
+ return f, s, var;
+end
+
+-- Return the last n items an iterator returns
function tail(n, f, s, var)
local results, count = {}, 0;
while true do
function tail(n, f, s, var)
local results, count = {}, 0;
while true do