diff options
author | Matthew Wild <mwild1@gmail.com> | 2019-03-23 08:47:55 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2019-03-23 08:47:55 +0000 |
commit | a274eacbbc62164a6567faeaa8d18ea5993a133f (patch) | |
tree | 8d3ea8293d31573b510d0521600817e8193ef29d /util | |
parent | 95314bb2be435c6b7527675d08c53ea8809b0690 (diff) | |
download | prosody-a274eacbbc62164a6567faeaa8d18ea5993a133f.tar.gz prosody-a274eacbbc62164a6567faeaa8d18ea5993a133f.zip |
util.queue: Add 'consume()' convenience iterator
Diffstat (limited to 'util')
-rw-r--r-- | util/queue.lua | 3 |
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 |