mirror of
https://github.com/minetest-mods/unified_inventory.git
synced 2024-12-29 04:00:24 +01:00
Allow Lua regexs in search, and check for bad ones
This commit is contained in:
parent
d30b33ba24
commit
b69fc35c88
11
internal.lua
11
internal.lua
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user