# HG changeset patch # User Matthew Wild # Date 1553608454 0 # Node ID 1bfd28e774dba06e79753849b9355a98f179e4c4 # Parent 8d0112413997a286f6be7e5b833328eeacd73db0 util.queue: Update :items() to consistently use private data directly It will perform better this way, and we were accessing private variables already within the iterator. Replaces 3eea63a68e0f diff -r 8d0112413997 -r 1bfd28e774db util/queue.lua --- a/util/queue.lua Tue Mar 26 13:51:06 2019 +0000 +++ b/util/queue.lua Tue Mar 26 13:54:14 2019 +0000 @@ -52,16 +52,15 @@ 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)