Skip to content

ax.util

Source: gamemode/framework/util/util_version.lua

Utility helpers used across the Parallax framework (printing, file handling, text utilities, etc.).

Section: version_utilities

Documented functions: 4

Functions


ax.util:GetBranch()

Returns the Git branch name this Parallax build was made from.

Performs the same two-tier lookup as GetVersion: live ax.version data first, then ReadVersionFile() as a fallback. Falls back to "unknown" when unavailable, so this function always returns a string. Useful for distinguishing between "main", "staging", or feature branches when diagnosing issues across different server deployments.

Realm: shared

Returns

  • string: The branch name (e.g. "main", "staging"), or "unknown" if version data is not available.

Usage

local branch = ax.util:GetBranch()  -- e.g. "main"

ax.util:GetCommitCount()

Returns the total commit count for this Parallax build.

Performs the same two-tier lookup as GetVersion: live ax.version data first, then ReadVersionFile() as a fallback. The value is coerced to a number via tonumber. Falls back to 0 when unavailable, so this function always returns a number. The commit count is useful for comparing build recency without parsing the version string.

Realm: shared

Returns

  • number: The commit count, or 0 as a safe fallback.

Usage

local count = ax.util:GetCommitCount()  -- e.g. 142

ax.util:GetCommitHash()

Returns the short Git commit hash for this Parallax build.

Performs the same two-tier lookup as GetVersion: live ax.version data first, then ReadVersionFile() as a fallback. Falls back to an empty string "" when unavailable, so this function always returns a string.

The hash is useful for identifying the exact source revision when reporting bugs or comparing server builds.

Realm: shared

Returns

  • string: The short commit hash (e.g. "a3f2c1d"), or "" if version data is not available.

Usage

local hash = ax.util:GetCommitHash()  -- e.g. "a3f2c1d"

ax.util:GetVersion()

Utility helpers used across the Parallax framework (printing, file handling, text utilities, etc.).

Versioning utilities.

Returns the Parallax framework version string (e.g. "0.3.42").

Performs a two-tier lookup:

  1. If ax.version is a table and ax.version.data.version is set (the live in-memory version populated at framework startup), that value is returned immediately.
  2. Otherwise, ax.version:ReadVersionFile() is called to read version.json from disk and extract the version field.

Falls back to "0.0.0" when neither source yields a value, so this function always returns a string — never nil.

Realm: shared

Returns

  • string: The version string, or "0.0.0" as a safe fallback.

Usage

local v = ax.util:GetVersion()  -- e.g. "0.3.42"