Fix detail matching

This commit is contained in:
Gabriel Tofvesson 2024-09-25 10:58:42 +00:00
parent a793a5c366
commit 4f145a991c

View File

@ -178,9 +178,9 @@ local function checkField(base, check)
if type(base) == "function" then if type(base) == "function" then
return base(check) return base(check)
end end
local baseType = type(base) local baseType = type(base)
if baseType == nil then if baseType == "nil" then
return true return true
elseif baseType ~= type(check) then elseif baseType ~= type(check) then
return false return false
@ -203,10 +203,10 @@ end
function FILTER_MATCHING_SLOTS(target) function FILTER_MATCHING_SLOTS(target)
return function(detail) return function(detail)
return target == nil or (checkField(target.name, detail.name) and return detail ~= nil and (target == nil or (checkField(target.name, detail.name) and
checkField(target.displayName, detail.displayName) and checkField(target.displayName, detail.displayName) and
checkField(target.damage, detail.damage) and checkField(target.damage, detail.damage) and
checkField(target.enchantments, detail.enchantments)) checkField(target.enchantments, detail.enchantments)))
end end
end end