Skip to content

ax.class

Class management system for creating, storing, and retrieving class data.

Documented functions: 7  ·  Realm: shared

Functions


ax.class:CanBecome(class, client)

Check if a player can become a specific class.

Runs through hook validation and class-specific CanBecome functions.

Realm: shared

Parameters

Name Type Description
class string\|number The class ID, index, or name
client Player The player entity to check permissions for

Returns

  • boolean,: string|nil True if allowed, false if not. Error message if denied.

Usage

local canBecome, reason = ax.class:CanBecome("security", player)

Source: gamemode/framework/libraries/sh_class.lua:157


ax.class:Get(identifier)

Get a class by its identifier.

Supports lookup by unique ID string, index number, name, or partial name matching.

Realm: shared

Parameters

Name Type Description
identifier string\|number The class ID, index, or name to search for

Returns

  • table|nil: The class table if found, nil otherwise

Usage

local class = ax.class:Get("security")
local class = ax.class:Get(1)

Source: gamemode/framework/libraries/sh_class.lua:131


ax.class:GetAll(filter)

Get all loaded class instances.

Returns the loaded class list, optionally filtered by faction or fuzzy name.

Realm: shared

Returns

  • table: Array of all class instances

Usage

local allClasses = ax.class:GetAll()
local cityClasses = ax.class:GetAll({ faction = FACTION_CITIZEN })
local securityMatches = ax.class:GetAll({ name = "security" })

Source: gamemode/framework/libraries/sh_class.lua:184


ax.class:HasAny(class, classes)

Check if a class matches any in a list of classes.

Used for validating if a class belongs to a set of allowed classes.

Realm: shared

Parameters

Name Type Description
class string\|number The class identifier to check
classes table Array of class identifiers to compare against

Returns

  • boolean: True if the class matches any in the list, false otherwise

Usage

if ax.class:HasAny(playerClass, {CLASS_SECURITY, CLASS_SCIENTIST}) then print("Player is security or scientist") end

Source: gamemode/framework/libraries/sh_class.lua:232


ax.class:Include(directory, timeFilter)

Include and load class files from a directory.

Recursively searches for class .lua files and loads them into the class system.

Automatically handles shared/client/server file prefixes.

Realm: shared

Parameters

Name Type Description
directory string The directory path to search for class files

Returns

  • boolean: True if the operation completed successfully, false on error

Usage

ax.class:Include("parallax/gamemode/classes")

Source: gamemode/framework/libraries/sh_class.lua:49


ax.class:Initialize()

Initialize the class system by loading all class files.

Automatically includes classes from framework, modules, and schema directories.

Called during framework boot to set up all available classes.

Realm: shared

Usage

ax.class:Initialize()

Source: gamemode/framework/libraries/sh_class.lua:25


ax.class:IsValid(class)

Check if a class exists and is valid.

Validates class existence by attempting to retrieve it.

Realm: shared

Parameters

Name Type Description
class string\|number The class identifier to validate

Returns

  • boolean: True if the class exists, false otherwise

Usage

if ax.class:IsValid("security") then print("Class exists") end

Source: gamemode/framework/libraries/sh_class.lua:217