From 6f588e1927ad9d8e5c8705e8efac5bd5b6022d11 Mon Sep 17 00:00:00 2001 From: Jean-Patrick Guerrero Date: Wed, 30 Jun 2021 21:23:58 +0200 Subject: [PATCH] Searches are now additive (Google-like) --- init.lua | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 74ad246..c9c49d8 100644 --- a/init.lua +++ b/init.lua @@ -117,6 +117,10 @@ end local old_is_creative_enabled = core.is_creative_enabled function core.is_creative_enabled(name) + if name == "" then + return old_is_creative_enabled(name) + end + return check_privs(name, {creative = true}) or old_is_creative_enabled(name) end @@ -616,7 +620,18 @@ local function search(data) end end else - to_add = find(search_in, filter, 1, true) + local ok = true + + for keyword in gmatch(filter, "%S+") do + if not find(search_in, keyword, 1, true) then + ok = nil + break + end + end + + if ok then + to_add = true + end end if to_add then