Модуль:AllPages: відмінності між версіями

нема опису редагування
(Створена сторінка: local p = {} function p.listSeasons(frame) local seasons = { "П'ятий сезон", "Четвертий сезон", "Третій сезон", "Другий сезон", "Перший сезон" } local output = {} for _, season in ipairs(seasons) do if mw.title.new(season).exists then table.insert(output, string.format("%s", season, season)) end end return table.concat(output, ", ") en...)
 
Немає опису редагування
Рядок 2: Рядок 2:


function p.listSeasons(frame)
function p.listSeasons(frame)
     local seasons = { "П'ятий сезон", "Четвертий сезон", "Третій сезон", "Другий сезон", "Перший сезон" }
     local seasons = {
        "П'ятий сезон", "Четвертий сезон", "Третій сезон", "Другий сезон", "Перший сезон"
        -- Add or remove seasons as needed
    }
     local output = {}
     local output = {}
      
     local count = 0
 
     for _, season in ipairs(seasons) do
     for _, season in ipairs(seasons) do
         if mw.title.new(season).exists then
         if mw.title.new(season).exists then
             table.insert(output, string.format("[[%s|%s]]", season, season))
             table.insert(output, string.format('<p>[[%s|%s]]</p>', season, season))
            count = count + 1
            if count >= 4 then
                break
            end
         end
         end
     end
     end
   
 
     return table.concat(output, ", ")
     return table.concat(output, "\n")
end
end


return p
return p