Module:GameVersion: Difference between revisions
From Vanguard Galaxy Wiki
More actions
Content deleted Content added
BETA=0.8.1.1 (matches in-game 4-segment build) |
update beta to 0.8.1.4 |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
-- Single source of truth for |
-- 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. |
||
-- automatically. Stale pages repopulate the tracking categories on next parse. |
|||
local p = {} |
local p = {} |
||
-- Latest STABLE public release. |
|||
local STABLE = "0.8.0" |
local STABLE = "0.8.0" |
||
local BETA = "0.8.1.4" -- "" if no beta is running |
|||
-- newer than STABLE is shown as beta; when BETA is promoted to STABLE those |
|||
-- stamps turn green automatically. |
|||
local BETA = "0.8.1.1" |
|||
-- "1.2.3" -> {1,2,3} |
local function parse(v) -- "1.2.3" -> {1, 2, 3} |
||
local function parse(v) |
|||
local t = {} |
local t = {} |
||
for n in tostring(v):gmatch("%d+") do |
for n in tostring(v):gmatch("%d+") do |
||
| Line 20: | Line 14: | ||
end |
end |
||
-- |
-- -1 if a < b, 0 if equal, 1 if a > b |
||
local function cmp(a, b) |
local function cmp(a, b) |
||
local pa, pb = parse(a), parse(b) |
local pa, pb = parse(a), parse(b) |
||
for i = 1, math.max(#pa, #pb) do |
|||
for i = 1, n do |
|||
local x, y = pa[i] or 0, pb[i] or 0 |
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 |
||
| Line 36: | Line 29: | ||
function p.beta() return BETA end |
function p.beta() return BETA end |
||
-- {{#invoke:GameVersion|status|< |
-- {{#invoke:GameVersion|status|<v>}} -> "current" | "beta" | "outdated" | "unknown" |
||
-- -> "current" | "beta" | "outdated" | "unknown" |
|||
function p.status(frame) |
function p.status(frame) |
||
local v = frame.args[1] |
local v = frame.args[1] |
||
| Line 47: | Line 39: | ||
end |
end |
||
-- |
-- require('Module:GameVersion') accessors for other Lua modules |
||
p.stableVersion = STABLE |
p.stableVersion = STABLE |
||
p.betaVersion = BETA |
p.betaVersion = BETA |
||
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