Module Definitions
Module definition system for the Lilia framework.
Overview
The module system provides comprehensive functionality for defining modules within the Lilia framework. Modules represent self-contained systems that add specific functionality to the gamemode, each with unique properties, behaviors, and configuration options. The system supports both server-side logic for gameplay mechanics and client-side properties for user interface and experience. Modules are defined using the MODULE table structure, which includes properties for identification, metadata, dependencies, privileges, and configuration. The system includes callback methods that are automatically invoked during key module lifecycle events, enabling dynamic behavior and customization. Modules can have dependencies, privileges, network strings, and various configuration options, providing a flexible foundation for modular systems.
name
📋 Purpose
Sets the display name of the module
💡 Example Usage
author
📋 Purpose
Sets the author of the module
💡 Example Usage
discord
📋 Purpose
Sets the Discord contact for the module author
💡 Example Usage
desc
📋 Purpose
Sets the description of the module
💡 Example Usage
-- Set a detailed description of what the module does
MODULE.desc = "A comprehensive inventory management system"
version
📋 Purpose
Sets the version number of the module
💡 Example Usage
versionID
📋 Purpose
Sets the unique version identifier for the module
💡 Example Usage
uniqueID
📋 Purpose
Unique identifier for the module (INTERNAL - set automatically when loaded)
⏰ When Called
Set automatically during module loading Note: This property is internal and should not be modified directly
💡 Example Usage
-- This is set automatically when the module is loaded from its folder name
-- Module in folder "inventory" will have uniqueID = "inventory"
Privileges
📋 Purpose
Sets the privileges required for this module
💡 Example Usage
-- Define required privileges for module access
MODULE.Privileges = {
{ Name = "canManageInventory", Min = 1 }
}
Dependencies
📋 Purpose
Sets the file dependencies for this module
💡 Example Usage
-- Define required files for this module
MODULE.Dependencies = {
{ File = "gridinv.lua", Type = "shared" }
}
NetworkStrings
📋 Purpose
Sets the network strings used by this module
💡 Example Usage
-- Define network strings for client-server communication
MODULE.NetworkStrings = {"liaInventoryOpen", "liaInventorySync"}
WorkshopContent
📋 Purpose
Sets the Workshop content IDs required by this module
💡 Example Usage
-- Set required Workshop content (single ID or table of IDs)
MODULE.WorkshopContent = "1234567890"
MODULE.WorkshopContent = {"1234567890", "0987654321"}
WebSounds
📋 Purpose
Sets the web-hosted sound files used by this module
💡 Example Usage
-- Define web-hosted sound files for the module
MODULE.WebSounds = {
["sounds/beep.wav"] = "https://example.com/sounds/beep.wav"
}
WebImages
📋 Purpose
Sets the web-hosted image files used by this module
💡 Example Usage
-- Define web-hosted image files for the module
MODULE.WebImages = {
["icons/inventory.png"] = "https://example.com/icons/inventory.png"
}
enabled
📋 Purpose
Sets whether the module is enabled by default
💡 Example Usage
-- Enable or disable the module by default
MODULE.enabled = function()
if not lia.config.get("EnableInventory", true) then
return false, "Inventory has been disabled in configuration"
end
return true
end
folder
📋 Purpose
Sets the folder path for the module Internal Variable: This is set automatically by the module system
path
📋 Purpose
Sets the file path for the module Internal Variable: This is set automatically by the module system
variable
📋 Purpose
Sets the variable name for the module Internal Variable: This is set automatically by the module system
loading
📋 Purpose
Sets whether the module is currently loading Internal Variable: This is set automatically by the module system
setData
📋 Purpose
Persists module-specific data via lia.data using the module's uniqueID
💡 Example Usage
getData
📋 Purpose
Retrieves the table saved by setData and returns the supplied default when nothing was stored yet
💡 Example Usage
ModuleLoaded
📋 Purpose
Called once the module and its dependencies have been fully initialized (permissions, includes, submodules, etc.) so you can do final setup.