ZenonSeth / logistica

A Minetest item transport and storage mod
Other
1 stars 4 forks source link

Request: string.lower in AP search #15

Closed Ocraw closed 1 month ago

Ocraw commented 1 month ago
local function do_search_for(stackList, term, stackListSize)
  if not stackList or not term or term:gsub("%s+","") == "" then return stackList, stackListSize end
  local match = function(stack) return string.find(string.lower(stack:get_description()), term) ~= nil end
  local grpS, grpE = term:find("group:")
  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
  end
function logistica.access_point_get_current_search_term(meta)
  return string.lower(meta:get_string(META_CURR_SEARCH))
end

Might not be ready to use as it is, anyway you got what I'm asking for.

ZenonSeth commented 1 month ago

I assume what you wanted was case-insensitive search by converting the descriptions to lower case first? I've addressed this in https://github.com/ZenonSeth/logistica/releases/tag/1.2.1 - also now published on ContentDB

Ocraw commented 1 month ago

Yup, thanks, lazy fingers are lazy.