mirror of
https://github.com/minetest-mods/unified_inventory.git
synced 2024-08-21 13:54:10 +02:00
Allow Lua regexs in search, and check for bad ones
This commit is contained in:
parent
d30b33ba24
commit
b69fc35c88
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user