Skip to content

ax.util

Source: gamemode/framework/util/util_print.lua

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

Section: print_utilities

Documented functions: 6

Functions


ax.util:PreparePackage(...)

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

Printing and logging helpers.

Converts a list of values into a flat array suitable for MsgC output.

Iterates the arguments and converts each one as follows:

  • Valid entities are converted to their tostring representation.
  • Valid player entities additionally get [SteamID64] appended as a separate element so the output clearly identifies who was involved.
  • All other values are included as-is.

A newline string is always appended as the last element so that each call to a Print* function ends on its own line. The returned table can be unpacked directly into MsgC or used with table.concat.

Realm: shared

Parameters

Name Type Description
... any Any number of values to prepare.

Returns

  • table: Flat array of values ready to unpack into MsgC or similar.

Usage

local pkg = ax.util:PreparePackage("Player joined:", somePlayer)
MsgC(Color(255, 255, 255), unpack(pkg))

ax.util:Print(...)

Prints an informational message prefixed with [PARALLAX].

Uses MsgC with color_print (blue-ish Color(100, 150, 255)). Visible on both server and client consoles. All arguments are processed through PreparePackage — entities are converted to strings and players get their SteamID64 appended. A trailing newline is included automatically.

Realm: shared

Parameters

Name Type Description
... any Values to print.

Returns

  • table: The prepared argument array that was printed.

Usage

ax.util:Print("Module loaded:", moduleName)
ax.util:Print("Player connected:", client)

ax.util:PrintDebug(...)

Prints a debug message, gated behind developer mode and realm convars.

Output is only produced when ALL of the following conditions are true:

  1. The developer convar is ≥ 1 (set with developer 1 in console).
  2. ax_debug_realm matches the current realm:
  3. 1 → client only
  4. 2 → server only
  5. 3 → both sides
  6. If ax_debug_filter is non-empty, the message must contain at least one of its comma-separated keywords (case-insensitive substring match).
  7. If ax_debug_rate_limit is positive, the same message (by content key) can only be printed once within that many seconds — prevents log spam from code running every frame.

Uses MsgC with color_debug (grey Color(150, 150, 150)). Returns nil silently when any gate condition prevents output.

Realm: shared

Parameters

Name Type Description
... any Values to include in the debug message.

Returns

  • table|nil: The prepared argument array when printed, nil when gated.

Usage

ax.util:PrintDebug("Character loaded:", char:GetName())
ax.util:PrintDebug("Store set:", key, "=", value)

ax.util:PrintError(...)

Prints an error message prefixed with [PARALLAX] [ERROR], with a stack trace.

Uses ErrorNoHaltWithStack, so the full call stack is included in the console output. Execution continues after the call — this does NOT throw.

Use this for non-fatal errors where you want clear diagnostics without stopping the current execution path. Arguments are joined with spaces via table.concat after PreparePackage processing.

Realm: shared

Parameters

Name Type Description
... any Values to include in the error message.

Returns

  • table: The prepared argument array that was printed.

Usage

ax.util:PrintError("Failed to load config:", err)

ax.util:PrintSuccess(...)

Prints a success message prefixed with [PARALLAX] [SUCCESS].

Uses MsgC with color_success (green Color(100, 255, 100)). Use to confirm that an operation completed as expected — module loads, database connections established, configuration saved successfully, etc.

Realm: shared

Parameters

Name Type Description
... any Values to include in the success message.

Returns

  • table: The prepared argument array that was printed.

Usage

ax.util:PrintSuccess("Database connected:", dbName)
ax.util:PrintSuccess("Configuration saved to", path)

ax.util:PrintWarning(...)

Prints a warning message prefixed with [PARALLAX] [WARNING].

Uses MsgC with color_warning (orange Color(255, 200, 100)). No stack trace is included — use PrintError when a stack trace is needed. Suitable for recoverable conditions that should be visible in the console without alarming users or halting execution.

Realm: shared

Parameters

Name Type Description
... any Values to include in the warning.

Returns

  • table: The prepared argument array that was printed.

Usage

ax.util:PrintWarning("Deprecated function called, use NewFunc instead")