Skip to content

Module

Module loading helpers for Lilia schemas, modules, submodules, dependencies, permissions, and module-provided assets.


Overview

The module library centralizes module discovery and loading under `lia.module`. It prepares the active `MODULE` or `SCHEMA` table, includes each module core file, registers privileges and dependencies, loads supported module folders and files, attaches module functions as hooks, initializes schema modules and overrides, and exposes lookup helpers for loaded modules.

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

Purpose

Initializes the schema and module loading sequence for the active gamemode.

Realm

Shared

Example Usage

  lia.module.initialize()

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.


DoModuleIncludes(path, module)View Source

Purpose

Runs after a module's standard files, folders, entities, networking strings, and client web assets are included.

Realm

Shared

Parameters

string path The directory path of the module being loaded.

table module The active module table for the module being loaded.


InitializedModules()View Source

Purpose

Runs after preload, base, schema, and override modules have been loaded.

Realm

Shared


InitializedSchema()View Source

Purpose

Runs after the active schema has been loaded and before preload, base, schema, and override modules are loaded.

Realm

Shared