API Reference
This page is a compact reference for sure_lib version2.2.1.
Module availability
Loader
function
required
Loads a module by name from the current runtime side.
table | nil
Returns a module table or
nil when unavailable.Validator
Builders
Builders
object(fields), array(itemRule), string(), number(), integer(), boolean(), and callback() create rules.Rule methods
Rule methods
required(message?), message(message), min(value), max(value), between(min, max), oneOf(values), and parse(data).Return and errors
Return and errors
parse(data) returns true when data is valid. It raises Validation Error: ... when data is invalid.Listener
function
Registers a local event.
function
Registers a network event.
function
Validates positional event parameters before the callback runs.
Track
function
Returns a getter and setter pair. The setter accepts a value or a functional update.
function
Runs
callback whenever one of the dependency getters changes.Player
- Data
- State
- Lifecycle
data, inventory, accounts, and loadout read current ESX player data. Inventory and account lists support lookup by name. Loadout supports normalized weapon lookup.Config
function
Loads and caches a Lua config file. When
schema is supplied, the cached or freshly loaded value is validated before it is returned.function
Reloads a Lua config file, replaces the cached value, and optionally validates it.
Spawn
LUI
- Page
- Builder nodes
- Declarative nodes
lui.page(pageId, pageBuilder, props?), lui.render(pageId), lui.open(pageId, focusOptions?), and lui.close(pageId) manage client NUI pages.Cooldown
- Server
- Client
define(key, definition) registers a cooldown definition with initialDurationMs, durationMs, optional pauseTimerOn, and optional resetAfterZeroTicks.DB
Console command:
sure_lib:db push <schemaName> creates a table from db/<schemaName>.lua; sure_lib:db pull <targetTable> writes a schema file from the current database table.
ESX
All ESX helpers return a boolean.
false means invalid input, missing player, malformed transaction data, or an unknown transaction action.