Module:Sandbox: Difference between revisions

Jump to navigation Jump to search
No edit summary
No edit summary
Line 39: Line 39:
end
end


-- Функция для получения всех способностей вышедших героев
-- Function to get all abilities of released heroes
function p.get_all_released_abilities_list()
function p.get_all_released_abilities_list()
     local abilities = {}
     local abilities = {}
      
      
     for hero_key, hero_data in pairs(heroes_data) do
     for hero_key, hero_data in pairs(heroes_data) do
         -- Проверяем, что герой выпущен
         -- Check if the hero is released
         if heroes_data_release.get_hero_release_status(hero_key) == "Released" then
         if heroes_data_release.get_hero_release_status(hero_key) == "Released" then
             -- Проверяем наличие BoundAbilities у героя
             -- Check if the hero has BoundAbilities
             if hero_data['BoundAbilities'] then
             if hero_data['BoundAbilities'] then
                 for _, ability_data in pairs(hero_data['BoundAbilities']) do
                 for _, ability_data in pairs(hero_data['BoundAbilities']) do
Line 57: Line 57:
     end
     end
      
      
     -- Удаляем дубликаты способностей
     -- Remove duplicate abilities
     local unique_abilities = {}
     local unique_abilities = {}
     for _, ability in ipairs(abilities) do
     for _, ability in ipairs(abilities) do
Line 63: Line 63:
     end
     end
      
      
     -- Собираем уникальные способности обратно в таблицу
     -- Collect unique abilities back into a table
     local result = {}
     local result = {}
     for ability, _ in pairs(unique_abilities) do
     for ability, _ in pairs(unique_abilities) do
Line 69: Line 69:
     end
     end
      
      
     -- Сортируем по алфавиту
     -- Sort alphabetically
     table.sort(result)
     table.sort(result)
      
      
     -- Объединяем через запятую
     -- Join with commas
     return table.concat(result, ", ")
     return table.concat(result, ", ")
end
end


return p
return p