aboutsummaryrefslogtreecommitdiffstats
path: root/util/queue.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-06-10 13:22:22 +0200
committerKim Alvefur <zash@zash.se>2019-06-10 13:22:22 +0200
commit5eba0ea836d508aeb3087a7d93f6e90cc1f92de8 (patch)
tree8cd84a76fb673cbfefa00ba1516bd16150f1c780 /util/queue.lua
parent1cc4ec5d808a55d32e3d51f30d8b50fe45268438 (diff)
parent2bb05d010d9b237a088bd9b4c997451407191d3f (diff)
downloadprosody-5eba0ea836d508aeb3087a7d93f6e90cc1f92de8.tar.gz
prosody-5eba0ea836d508aeb3087a7d93f6e90cc1f92de8.zip
Merge 0.11->trunk
Diffstat (limited to 'util/queue.lua')
-rw-r--r--util/queue.lua12
1 files changed, 7 insertions, 5 deletions
diff --git a/util/queue.lua b/util/queue.lua
index 728e905f..66ed098b 100644
--- a/util/queue.lua
+++ b/util/queue.lua
@@ -52,18 +52,20 @@ local function new(size, allow_wrapping)
return t[tail];
end;
items = function (self)
- --luacheck: ignore 431/t
- return function (t, pos)
- if pos >= t:count() then
+ return function (_, pos)
+ if pos >= items then
return nil;
end
local read_pos = tail + pos;
- if read_pos > t.size then
+ if read_pos > self.size then
read_pos = (read_pos%size);
end
- return pos+1, t._items[read_pos];
+ return pos+1, t[read_pos];
end, self, 0;
end;
+ consume = function (self)
+ return self.pop, self;
+ end;
};
end