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

View File

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