Allow Lua regexs in search, and check for bad ones

This commit is contained in:
ShadowNinja 2013-12-21 12:26:37 -05:00
parent d30b33ba24
commit b69fc35c88

@ -92,14 +92,9 @@ function unified_inventory.apply_filter(player, filter)
local player_name = player:get_player_name() local player_name = player:get_player_name()
local size = 0 local size = 0
local lfilter = string.lower(filter) local lfilter = string.lower(filter)
if lfilter ~= "" then if not pcall(function() ("technic:test"):find(lfilter) end) then
for c in lfilter:gmatch(".") do -- Filter is invalid
if c == '[' or c == ']' or c == '{' or c == '}' or lfilter = ""
c == '(' or c == ')' or c == '%' then
lfilter = ""
break
end
end
end end
unified_inventory.filtered_items_list[player_name]={} unified_inventory.filtered_items_list[player_name]={}
for name, def in pairs(minetest.registered_items) do for name, def in pairs(minetest.registered_items) do