Module¶
Module loading helpers for Lilia schemas, modules, submodules, dependencies, permissions, and module-provided assets.
Overview
lia.module.load(uniqueID, path, variable, skipSubmodules)View Source
Purpose
Loads a schema, module, or submodule from a directory and registers its metadata, dependencies, permissions, extras, hooks, and optional submodules.
Realm
Shared
Parameters
string uniqueID The unique identifier used to register and retrieve the module.
string path The directory path that contains the module core file and optional module folders.
string variable optional The global table name used while loading the module. Defaults to `MODULE`; schemas use `SCHEMA`.
boolean skipSubmodules optional Whether submodules should be skipped after the module finishes loading.
Example Usage
lia.module.load("inventory", "lilia/gamemode/modules/inventory", "MODULE")
lia.module.load("schema", engine.ActiveGamemode():gsub("\\", "/") .. "/schema", "SCHEMA")
lia.module.initialize()View Source
lia.module.loadFromDir(directory, group, skip)View Source
Purpose
Loads every folder in a directory as a module, unless that folder is listed in the skip table.
Realm
Shared
Parameters
string directory The directory whose child folders should be loaded as modules.
string group optional The module group used to determine the loading global. `schema` uses `SCHEMA`; all other values use `MODULE`.
table skip optional A table of module identifiers to skip, keyed by folder name.
Example Usage
lia.module.loadFromDir("lilia/gamemode/modules", "module")
lia.module.loadFromDir("schema/modules", "module", {example = true})
lia.module.get(identifier)View Source
Purpose
Returns a loaded module table by its unique identifier.
Realm
Shared
Parameters
string identifier The unique identifier of the module to retrieve.
Returns
table|nil The loaded module table, or nil if no module is registered with that identifier.
Example Usage
local module = lia.module.get("inventory")
if module then print(module.name) end
Hooks
Library-specific hooks documented for this library.