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 | 2080433daf5a956d0456c6ce24ce1ef9183a023e (patch) | |
tree | 8d3ea8293d31573b510d0521600817e8193ef29d /util | |
parent | 268e487245b73baee4f8d8add6d12707d278f371 (diff) | |
download | prosody-2080433daf5a956d0456c6ce24ce1ef9183a023e.tar.gz prosody-2080433daf5a956d0456c6ce24ce1ef9183a023e.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 |