Use plain substring search in craft guide

The user input was being erroneously treated as a lua regexp.
This commit is contained in:
Zefram 2014-06-13 08:34:29 +01:00 committed by Diego Martinez
parent 833a255ad4
commit 7f4f0fd225

@ -97,10 +97,6 @@ end
function unified_inventory.apply_filter(player, filter) function unified_inventory.apply_filter(player, filter)
local player_name = player:get_player_name() local player_name = player:get_player_name()
local lfilter = string.lower(filter) local lfilter = string.lower(filter)
if not pcall(function() ("technic:test"):find(lfilter) end) then
-- Filter is invalid
lfilter = ""
end
local ffilter local ffilter
if lfilter:sub(1, 6) == "group:" then if lfilter:sub(1, 6) == "group:" then
local groups = lfilter:sub(7):split(",") local groups = lfilter:sub(7):split(",")
@ -116,7 +112,7 @@ function unified_inventory.apply_filter(player, filter)
ffilter = function(name, def) ffilter = function(name, def)
local lname = string.lower(name) local lname = string.lower(name)
local ldesc = string.lower(def.description) local ldesc = string.lower(def.description)
return string.find(lname, lfilter) or string.find(ldesc, lfilter) return string.find(lname, lfilter, 1, true) or string.find(ldesc, lfilter, 1, true)
end end
end end
unified_inventory.filtered_items_list[player_name]={} unified_inventory.filtered_items_list[player_name]={}