Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:GameVersion: Difference between revisions

Content deleted Content added
Trim comments to ones that add value beyond the code
update beta to 0.8.1.4
 
(2 intermediate revisions by the same user not shown)
Line 4: Line 4:


local STABLE = "0.8.0"
local STABLE = "0.8.0"
local BETA = "0.8.1.1" -- "" if no beta is running
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 / unknown for 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