Модуль:AllPages: відмінності між версіями
| Admin (обговорення | внесок)  (Створена сторінка: 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...) | Admin (обговорення | внесок)  Немає опису редагування | ||
| Рядок 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( |              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 | ||
Версія за 22:16, 21 квітня 2024
Документацію для цього модуля можна створити у Модуль:AllPages/документація
local p = {}
function p.listSeasons(frame)
    local seasons = {
        "П'ятий сезон", "Четвертий сезон", "Третій сезон", "Другий сезон", "Перший сезон"
        -- Add or remove seasons as needed
    }
    local output = {}
    local count = 0
    for _, season in ipairs(seasons) do
        if mw.title.new(season).exists then
            table.insert(output, string.format('<p>[[%s|%s]]</p>', season, season))
            count = count + 1
            if count >= 4 then
                break
            end
        end
    end
    return table.concat(output, "\n")
end
return p