GE Lua Documentation

Press F to search!

onFilterCustomLevelTiles

Definition


-- @/lua/ge/extensions/ui/gameplaySelector/tileGenerators/levelTiles.lua:239



local function onFilterCustomLevelTiles(item, searchText, result)
  if not searchText or searchText == "" then
    return
  end
  local searchTextLower = string.lower(searchText)
  local level = core_levels.getLevelByName(item.levelName)
  if level then
    if level.biome then
      if string.find(string.lower(translate(level.biome)), searchTextLower, 1, true) then
        result.match = true
        return
      end
    end
    if level.suitablefor then
      if string.find(string.lower(translate(level.suitablefor)), searchTextLower, 1, true) then
        result.match = true
        return
      end
    end
    if level.features then
      if string.find(string.lower(translate(level.features)), searchTextLower, 1, true) then
        result.match = true
        return
      end
    end
    if level.roads then
      if string.find(string.lower(translate(level.roads)), searchTextLower, 1, true) then
        result.match = true
        return
      end
    end
    if level.country then
      if string.find(string.lower(translate(level.country)), searchTextLower, 1, true) then
        result.match = true
        return
      end
    end
  end
end

Callers