aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2019-03-23 08:47:55 +0000
committerMatthew Wild <mwild1@gmail.com>2019-03-23 08:47:55 +0000
commita274eacbbc62164a6567faeaa8d18ea5993a133f (patch)
tree8d3ea8293d31573b510d0521600817e8193ef29d /util
parent95314bb2be435c6b7527675d08c53ea8809b0690 (diff)
downloadprosody-a274eacbbc62164a6567faeaa8d18ea5993a133f.tar.gz
prosody-a274eacbbc62164a6567faeaa8d18ea5993a133f.zip
util.queue: Add 'consume()' convenience iterator
Diffstat (limited to 'util')
-rw-r--r--util/queue.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/util/queue.lua b/util/queue.lua
index 728e905f..e63b3f1c 100644
--- a/util/queue.lua
+++ b/util/queue.lua
@@ -64,6 +64,9 @@ local function new(size, allow_wrapping)
return pos+1, t._items[read_pos];
end, self, 0;
end;
+ consume = function (self)
+ return self.pop, self;
+ end;
};
end