[added] functional.find_best accepts (ignores) nil results for easy filtering

This commit is contained in:
Max Cahill 2020-03-20 22:31:20 +11:00
parent 370aee6cbc
commit 3674846f11

View File

@ -248,7 +248,7 @@ function _table.find_best(t, f)
local current_best = -math.huge
for k,e in pairs(t) do
local v = f(e, k)
if v > current_best then
if v and v > current_best then
current_best = v
current = e
end