Module:GameVersion
From Vanguard Galaxy Wiki
More actions
Template:Documentation subpage Single source of truth for the current Vanguard Galaxy version state.
Configuration
Edit two values at the top of Module:GameVersion once per release:
STABLE- The latest stable public release. Content stamped at this version reads as current.
BETA- The current beta / preview line (or
""if none). Content newer than STABLE reads as beta.
Promote a beta by setting STABLE to the old BETA value — every Template:Tl stamp for that version turns green automatically.
Entry points
0.8.0/|beta- Return the configured version strings.
outdated- Returns
current/beta/outdated/unknownfor version v. Used by Template:Tl. require('Module:GameVersion')- Exposes
stableVersion,betaVersion, and_cmp(a,b)for other modules.
See also
- Template:Tl — the per-content version stamp that consumes this module.
-- Single source of truth for Vanguard Galaxy version state.
-- Bump STABLE / BETA here on each release; every {{Ver}} stamp re-evaluates
-- automatically. Stale pages repopulate the tracking categories on next parse.
local p = {}
-- Latest STABLE public release.
local STABLE = "0.8.0"
-- Current BETA / preview line, or "" if none is running. Content stamped
-- newer than STABLE is shown as beta; when BETA is promoted to STABLE those
-- stamps turn green automatically.
local BETA = "0.8.1"
-- "1.2.3" -> {1,2,3}
local function parse(v)
local t = {}
for n in tostring(v):gmatch("%d+") do
t[#t + 1] = tonumber(n)
end
return t
end
-- Compare version strings. Returns -1 if a<b, 0 if equal, 1 if a>b.
local function cmp(a, b)
local pa, pb = parse(a), parse(b)
local n = math.max(#pa, #pb)
for i = 1, n do
local x, y = pa[i] or 0, pb[i] or 0
if x < y then return -1 end
if x > y then return 1 end
end
return 0
end
-- {{#invoke:GameVersion|stable}} / |beta
function p.stable() return STABLE end
function p.beta() return BETA end
-- {{#invoke:GameVersion|status|<version>}}
-- -> "current" | "beta" | "outdated" | "unknown"
function p.status(frame)
local v = frame.args[1]
if not v or v == "" then return "unknown" end
local c = cmp(v, STABLE)
if c < 0 then return "outdated" end
if c == 0 then return "current" end
return "beta"
end
-- Plain-Lua accessors for other modules
p.stableVersion = STABLE
p.betaVersion = BETA
p._cmp = cmp
return p