Fix AP search using pattern matching unnecessarily

This commit is contained in:
Zenon Seth 2024-07-24 15:50:28 +01:00
parent 7493f657d9
commit 8f465fe547

View File

@ -46,8 +46,8 @@ local get_meta = minetest.get_meta
local function do_search_for(stackList, term, stackListSize)
if not stackList or not term or term:gsub("%s+","") == "" then return stackList, stackListSize end
term = string.lower(term)
local match = function(stack) return string.find(string.lower(stack:get_description()), term) ~= nil end
local grpS, grpE = term:find("group:")
local match = function(stack) return string.find(string.lower(stack:get_description()), term, nil, true) ~= nil end
local grpS, grpE = term:find("group:", nil, true)
if grpS and grpS == 1 then
local groupName = string.sub(term, grpE + 1)
match = function(stack) return minetest.get_item_group(string.lower(stack:get_name()), groupName) > 0 end