# HG changeset patch # User Kim Alvefur # Date 1448480981 -3600 # Node ID 0a31ec3193f027839afbb47dd31d8affc5e3b3a7 # Parent f12deb882148ee6884196bd25b2c895536658ba5 util.cache: Make sure cache size is specified as an integer diff -r f12deb882148 -r 0a31ec3193f0 util/cache.lua --- a/util/cache.lua Wed Nov 25 20:43:29 2015 +0100 +++ b/util/cache.lua Wed Nov 25 20:49:41 2015 +0100 @@ -2,6 +2,8 @@ local cache_mt = { __index = cache_methods }; local function new(size) + size = assert(tonumber(size), "cache size must be a number"); + size = math.floor(size); assert(size > 0, "cache size must be greater than zero"); local data = {}; return setmetatable({ data = data, count = 0, size = size, head = nil, tail = nil }, cache_mt);