Module
Example
MODULE.name = "A Module"
MODULE.author = "76561198312513285"
MODULE.discord = "@liliaplayer"
MODULE.version = "Stock"
MODULE.desc = "This is an Example Module."
MODULE.WorkshopContent = {"2959728255"}
MODULE.enabled = true
MODULE.CAMIPrivileges = {
{
Name = "Staff Permissions - Kekw",
MinAccess = "superadmin",
Description = "Allows access to kewking.",
},
}
MODULE.Dependencies = {
{
File = MODULE.path .. "/nicebogusfile.lua",
Realm = "server",
},
{
File = MODULE.path .. "/badbogusfile.lua",
Realm = "client",
},
}
Key Variables Explained
Variable | Purpose | Type | Example |
---|---|---|---|
MODULE.name |
Identifies the module by name. | String |
MODULE.name = "A Module" Names the module “A Module.” |
MODULE.author |
Specifies the module’s author (e.g., STEAMID64 or a name). | String |
MODULE.author = "76561198312513285" Sets the author’s SteamID64. |
MODULE.discord (Optional) |
Provides the Discord handle of the author or support channel. | String |
MODULE.discord = "@liliaplayer" Displays the author’s Discord tag. |
MODULE.version (Optional) |
Tracks the module’s version or release state. | String |
MODULE.version = "Stock" Marks the module’s version as “Stock.” |
MODULE.desc |
Describes the module’s functionality or purpose. | String |
MODULE.desc = "This is an Example Module." Gives a short overview of the module. |
MODULE.identifier (Optional) |
A unique identifier for external references to this module. | String |
MODULE.identifier = "example_mod" Helps in referencing the module externally. |
MODULE.CAMIPrivileges (Optional) |
Defines CAMI permissions for the module. | Table |
See CAMIPrivileges Details. |
MODULE.WorkshopContent (Optional) |
Lists Workshop add-on IDs required by the module. | Table of Strings |
MODULE.WorkshopContent = {"2959728255"} Includes relevant Workshop items. |
MODULE.enabled (Optional) |
Toggles module activation. | Boolean |
MODULE.enabled = true Enables the module. |
MODULE.Dependencies (Optional) |
Specifies files and realms this module depends on. | Table of Table |
See Dependencies Details. |
Detailed Descriptions
1. MODULE.name
-
Purpose:
Names the module and is used for identification in logs or load orders. -
Type:
String
-
Example:
Sets the module’s name to “A Module.”
2. MODULE.author
-
Purpose:
Specifies the module’s author (e.g., STEAMID64 or a name). -
Type:
String
-
Example:
Sets the author’s SteamID64.
3. MODULE.discord
(Optional)
-
Purpose:
Provides a Discord handle or server invite for support or communication. -
Type:
String
-
Example:
Displays the author’s or module support’s Discord tag.
4. MODULE.version
(Optional)
-
Purpose:
Tracks the module’s version or release state. -
Type:
String
-
Example:
Sets the module version to “Stock.” Can help in version control.
5. MODULE.desc
-
Purpose:
Describes the module’s functionality or purpose. -
Type:
String
-
Example:
Gives users a quick summary of what the module does.
6. MODULE.identifier
(Optional)
-
Purpose:
A unique identifier for external references to this module. -
Type:
String
-
Example:
Allows other scripts or systems to reference this specific module.
7. MODULE.CAMIPrivileges
(Optional)
-
Purpose:
Defines CAMI (Custom Admin Mod Interface) permissions required or provided by the module.
Each privilege can have keys likeName
,MinAccess
, andDescription
. -
Type:
Table
-
Example:
Sets up privileges using the CAMI system so admin mods can integrate these permissions.
8. MODULE.WorkshopContent
(Optional)
-
Purpose:
Lists Workshop add-on IDs required by the module, enabling automatic downloading if your server or client references them. -
Type:
Table
ofStrings
-
Example:
Ensures users download the specified Workshop add-ons.
9. MODULE.enabled
(Optional)
-
Purpose:
Toggles module activation. Iffalse
, the module may not load or function. -
Type:
Boolean
-
Example:
Indicates that the module is currently active.
10. MODULE.Dependencies
(Optional)
-
Purpose:
Specifies additional files or libraries needed by this module, along with where (client or server) they should load. -
Type:
Table
ofTable
-
Example:
Ensures the server or client includes any files on which this module depends.
Automatically Included Files and Folders
When you place standard named files or folders in your module’s directory, many frameworks will auto-include them by default. Here’s a brief overview:
Files
client.lua
-
Runs exclusively on the clients. Usually used for shorter modules.
-
server.lua
-
Runs exclusively on the server. Usually used for shorter modules.
-
config.lua
-
Stores configuration variables shared across the module. This file is shared between the server and client.
-
commands.lua
- Contains command definitions. This file is shared between the server and client.
Folders
-
config
Stores configuration files for customizing addon settings without modifying core scripts. -
dependencies
Contains essential libraries or resources that must load before other scripts. -
libs
Includes utility scripts or global helper functions used across the addon. -
hooks
Houses scripts to register and manage Garry's Mod or custom hooks. -
libraries
Contains standalone systems or major subsystems for the addon. -
commands
Defines custom chat (/command
) or console commands. -
netcalls
Manages client-server communication using thenet
library. -
meta
Extends or modifies metatables for core objects likePlayer
orEntity
. -
derma
Creates visual GUI elements like panels, menus, or HUDs. -
pim
Focuses on Player Interaction Menu definitions and actions.