Skip to main content

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

API shape

string
required
Module name. Names are case-insensitive in practice because the loader lowercases the input.
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
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.