Module:UpdateNumber

local p = {} local versionData = mw.loadData( 'Module:UpdateNumber/data' )

local function currentUpdate local pageName = mw.title.getCurrentTitle.text

if versionData[pageName] then return pageName end local updateNo = tonumber(pageName:match("^Update (%d+)"))

local versionNo = "" if updateNo then for k, v in pairs(versionData) do           if v[3] and updateNo == v[3] then versionNo = k               break end end end return versionNo end

function p.getVersion(frame) local tArgs

if frame == mw.getCurrentFrame then fParent = frame:getParent tArgs = fParent.args

if (fParent.args[1]) then tArgs = fParent.args else tArgs = frame.args end else tArgs = frame end

local versionNo = tArgs[1] or "" local outType  = tArgs[2] or "" local txtOnly  = (tArgs[3] and tArgs[3] ~= "")

if versionNo == "" then versionNo = currentUpdate end

local inclDate = false

if outType == "D" then inclDate = true elseif outType == "N" then -- output next version -- versionNo = nextUpdate(versionNo) elseif outType == "P" then -- output previous version -- versionNo = prevUpdate(versionNo) end

local versionText

if versionData[versionNo] then versionText = versionData[versionNo][1] .. " Update"

if not txtOnly then versionText = "" .. versionText .. "" end

if inclDate then versionText = versionText .. " on " .. versionData[versionNo][2] end else versionText = "Unknown Version" end

return versionText end return p