From a37f44dbce7d7dd5403bcbc92b5a939c36b4b26b Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sat, 2 Nov 2024 12:06:37 +0100 Subject: [PATCH] Fix crash when searching for "[" --- init.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/init.lua b/init.lua index 6994639..c6c23da 100644 --- a/init.lua +++ b/init.lua @@ -127,13 +127,13 @@ local collect_items = function(filter, lang_code) -- First, try to match original description if desc ~= "" then local ldesc = string.lower(desc) - matches = string.match(ldesc, filter) ~= nil + matches = string.find(ldesc, filter, 1, true) ~= nil -- Second, try to match translated description if not matches then local tdesc = minetest.get_translated_string(lang_code, desc) if tdesc ~= "" then tdesc = string.lower(tdesc) - matches = string.match(tdesc, filter) ~= nil + matches = string.find(tdesc, filter, 1, true) ~= nil end end -- Third, try to match translated short description @@ -142,14 +142,14 @@ local collect_items = function(filter, lang_code) if sdesc ~= "" then sdesc = minetest.get_translated_string(lang_code, sdesc) sdesc = string.lower(sdesc) - matches = string.match(sdesc, filter) ~= nil + matches = string.find(sdesc, filter, 1, true) ~= nil end end end -- Fourth, try to match itemstring if not matches then - matches = string.match(itemstring, filter) ~= nil + matches = string.find(itemstring, filter, 1, true) ~= nil end -- If item was matched, add to item list