mirror of
https://github.com/1bardesign/batteries.git
synced 2024-11-25 23:24:35 +00:00
[added] functional.find_best accepts (ignores) nil results for easy filtering
This commit is contained in:
parent
370aee6cbc
commit
3674846f11
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user