updated search algorithm

This commit is contained in:
Chr1Z93 2024-06-27 16:04:22 +02:00
parent 27c96df747
commit 9954e1df80

View File

@ -404,8 +404,14 @@ function buildAvailableWeaknesses(traits)
-- split the string into separate traits (separated by "|") -- split the string into separate traits (separated by "|")
local allowedTraits = {} local allowedTraits = {}
for str in traits:gmatch("([^|]+)") do for str in traits:gmatch("([^|]+)") do
-- remove dots
str = str:gsub("[%.]", "")
-- remove leading and trailing whitespace
str = str:match("^%s*(.-)%s*$")
-- make sure string ends with a dot -- make sure string ends with a dot
str = string.lower(str:gsub("[%.]", "") .. ".") str = string.lower(str .. ".")
table.insert(allowedTraits, str) table.insert(allowedTraits, str)
end end