Software /
code /
prosody
Comparison
util/queue.lua @ 9925:8d0112413997
Backed out changeset 3eea63a68e0f
Commit included intended changes to loggingmanager
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 26 Mar 2019 13:51:06 +0000 |
parent | 9902:3eea63a68e0f |
child | 9926:1bfd28e774db |
comparison
equal
deleted
inserted
replaced
9924:5a2e53bef031 | 9925:8d0112413997 |
---|---|
50 return nil; | 50 return nil; |
51 end | 51 end |
52 return t[tail]; | 52 return t[tail]; |
53 end; | 53 end; |
54 items = function (self) | 54 items = function (self) |
55 return function (_, pos) | 55 --luacheck: ignore 431/t |
56 if pos >= items then | 56 return function (t, pos) |
57 if pos >= t:count() then | |
57 return nil; | 58 return nil; |
58 end | 59 end |
59 local read_pos = tail + pos; | 60 local read_pos = tail + pos; |
60 if read_pos > self.size then | 61 if read_pos > t.size then |
61 read_pos = (read_pos%size); | 62 read_pos = (read_pos%size); |
62 end | 63 end |
63 return pos+1, t[read_pos]; | 64 return pos+1, t._items[read_pos]; |
64 end, self, 0; | 65 end, self, 0; |
65 end; | 66 end; |
66 consume = function (self) | 67 consume = function (self) |
67 return self.pop, self; | 68 return self.pop, self; |
68 end; | 69 end; |