Module:GameVersion: Difference between revisions
From Vanguard Galaxy Wiki
More actions
Content deleted Content added
update beta to 0.8.1.4 |
|||
| Line 4: | Line 4: | ||
local STABLE = "0.8.0" |
local STABLE = "0.8.0" |
||
local BETA = "0.8.1. |
local BETA = "0.8.1.4" -- "" if no beta is running |
||
local function parse(v) -- "1.2.3" -> {1, 2, 3} |
local function parse(v) -- "1.2.3" -> {1, 2, 3} |
||
Latest revision as of 23:37, 5 June 2026
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 the game version. Bump STABLE / BETA here on each
-- release; every {{Ver}} stamp re-evaluates on the next page parse.
local p = {}
local STABLE = "0.8.0"
local BETA = "0.8.1.4" -- "" if no beta is running
local function parse(v) -- "1.2.3" -> {1, 2, 3}
local t = {}
for n in tostring(v):gmatch("%d+") do
t[#t + 1] = tonumber(n)
end
return t
end
-- -1 if a < b, 0 if equal, 1 if a > b
local function cmp(a, b)
local pa, pb = parse(a), parse(b)
for i = 1, math.max(#pa, #pb) 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|<v>}} -> "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
-- require('Module:GameVersion') accessors for other Lua modules
p.stableVersion = STABLE
p.betaVersion = BETA
p._cmp = cmp
return p