Skip to content

Server Object

Konijima edited this page Jul 11, 2022 · 1 revision

To access the server object you must require it in your file.

local Server = require 'MyModName/Server';

Properties

Server.Config                           -- Contains your shared config
Server.Utils                            -- Contains your shared utility functions
Server.Data                             -- Contains your server GlobalModData tables
Server.Modules                          -- Contains your server modules
Server.Commands                         -- Contains your client command handlers

Methods

Server.Log(str)                             -- Log a message with your mod name as prefix
Server.SendCommand(command, data, player)   -- Send a command with data to client(s)
Server.AddEvent(eventName, callback)        -- Add a callback to a custom event
Server.RemoveEvent(eventName, callback)     -- Remove a callback from a custom event
Server.TriggerEvent(eventName, ...)         -- Trigger a custom event with up to 8 parameters
Server.TransmitModData(modDataName)         -- Transmit a GlobalModData table to all clients