# HG changeset patch # User Kim Alvefur # Date 1638396191 -3600 # Node ID a91494a4c3d0cf8bff56016571600e1a2d07a119 # Parent 705c4c07a86025883f3fb26f2fe631022b4d0fd8 mod_smacks: Fix empty cache check In Lua, every value except `nil` and `false` are considered true in boolean expressions, even `0` as here, which means this was dead code. diff -r 705c4c07a860 -r a91494a4c3d0 plugins/mod_smacks.lua --- a/plugins/mod_smacks.lua Wed Dec 01 21:04:32 2021 +0100 +++ b/plugins/mod_smacks.lua Wed Dec 01 23:03:11 2021 +0100 @@ -70,7 +70,7 @@ if not stores[user] then stores[user] = cache.new(max_entries, evict_callback); end stores[user]:set(key, value); -- remove empty caches completely - if not stores[user]:count() then stores[user] = nil; end + if stores[user]:count() == 0 then stores[user] = nil; end end; }; end