Module:ListRobloxVersions

local studio_builds = require("Module:StudioVersions") local version_helpers = require("Module:VersionHelpers") local version_metadata = require("Module:VersionMetadata")

local language = mw.language.getContentLanguage

local p = {}

--% This function generates a list of Roblox versions. --@ year (number) if specified, the list will only contain versions in that year --@ description_func (function) a function that, given a number for a minor version, returns a description of that version --: (string) the generated list function p.list_roblox_versions(year, description_func) local builds_by_minor_version = {} for _, build in ipairs(studio_builds) do       local _, minor = version_helpers.parse_version_string(build.version) minor = tonumber(minor) if not builds_by_minor_version[minor] then builds_by_minor_version[minor] = {} end table.insert(builds_by_minor_version[minor], build) end local minor_versions = {} for minor_version in pairs(builds_by_minor_version) do       table.insert(minor_versions, minor_version) end table.sort(minor_versions, function(fst, snd) return snd < fst end) local output = "" for _, minor_version in ipairs(minor_versions) do       local builds = builds_by_minor_version[minor_version] local date_of_first_build = builds[1].date if year == nil or year == tonumber(language:formatDate("Y", date_of_first_build)) then local formatted_date = language:formatDate("F j, Y", date_of_first_build) output = output .. "== "               .. mw.text.tag("span", {id = minor_version}, minor_version) .. " – "               .. formatted_date .. "==\n" local metadata = version_metadata[minor_version] if metadata then local links = {} if metadata.wiki then table.insert(links, "Change log") end if metadata.devhub then table.insert(links, "[" .. metadata.devhub .. " Release notes]") end if metadata.devforum then table.insert(links, "[" .. metadata.devforum .. " Discussion]") end output = output .. "\n" .. table.concat(links, " &middot; ") .. "\n" end if description_func then local description = description_func(minor_version) if description then output = output .. "\n" .. description .. "\n" end end output = output .. "\n=== Builds ===\n\n" for _, build in ipairs(builds) do               output = output .. "* "                   .. mw.text.tag("span", {id = build.hash}, build.hash) ..                   " ("                    .. mw.text.tag("span", {id = build.version}, build.version)                    .. ", .. language:formatDate("Y", build.date)                    .. ".html#"                    .. build.hash                    .. " API changes)\n" end end end return output end

return p