From 8fb50705d126977940bb6579147936e57e43cf1e Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 15 Apr 2016 13:19:20 +0200 Subject: util.cache: Add method for iterating over values --- util/cache.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/util/cache.lua b/util/cache.lua index 074916cd..54f3e10b 100644 --- a/util/cache.lua +++ b/util/cache.lua @@ -88,6 +88,18 @@ function cache_methods:items() end end +function cache_methods:values() + local m = self._head; + return function () + if not m then + return; + end + local v = m.value; + m = m.next; + return v; + end +end + function cache_methods:count() return self._count; end -- cgit v1.2.3