Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.sure-developer.com/llms.txt

Use this file to discover all available pages before exploring further.

Module Loader

The shared loader creates a global sure table and exposes sure.getModule(name). It resolves the requested module by name, checks the current runtime side, and requires the correct Lua file.
The loader is imported with shared_script '@sure_lib/init.lua'. On the client, sure.player is automatically assigned to the client player module.

Resolution table

NameClientServer
validatorShared moduleShared module
listenerShared moduleShared module
trackShared moduleShared module
configShared moduleShared module
playerClient modulenil
spawnClient modulenil
luiClient modulenil
cooldownClient moduleServer module
dbnilServer module
esxnilServer module

API shape

name
string
required
Module name. Names are case-insensitive in practice because the loader lowercases the input.
module
table | nil
Returns the module table when the module exists on the current side. Returns nil for unknown modules, non-string names, or side-specific modules requested from the wrong side.
shared.lua
local validator = sure.getModule('validator')
local config = sure.getModule('config')
local cooldown = sure.getModule('cooldown')
local missing = sure.getModule('missing')
local validator = sure.getModule('validator')
local cooldown = sure.getModule('cooldown')
local spawn = sure.getModule('spawn')
local lui = sure.getModule('lui')
local player = sure.player

if not cooldown then
  error('cooldown module is not available on this side')
end
Load modules at the top of a file when the module is required for every execution path. Load inside a function when the module is optional or side-dependent.