ax.type¶
Source: gamemode/framework/libraries/sh_type.lua
The type library provides utilities for type detection, sanitization, and formatting.
Documented functions: 3
Functions¶
ax.type:Detect(value)¶
Detects the type ID of a given value. Automatically determines the appropriate type constant for any Lua value. Useful for dynamic type checking and validation.
Realm: shared
Parameters
| Name | Type | Description |
|---|---|---|
value |
any |
The value to detect the type of |
Returns
number|nil: The detected type ID, or nil if the type could not be determined
Usage
ax.type:Format(typeID)¶
Formats a type ID into a human-readable string. Converts type constants into user-friendly names for display purposes.
Realm: shared
Parameters
| Name | Type | Description |
|---|---|---|
typeID |
number |
The type ID to format |
Returns
string: The formatted type name
Usage
ax.type:Sanitise(typeID, value)¶
Sanitizes a value to match the specified type ID. Converts and validates values to ensure they conform to the expected type. Returns nil if the value cannot be sanitized to the target type.
Realm: shared
Parameters
| Name | Type | Description |
|---|---|---|
typeID |
number |
The type ID to sanitize the value to |
value |
any |
The value to sanitize |
Returns
any: The sanitized value, or nil if sanitization failed
Usage