๐ค Console
Exposes access to registering Console Commands and Logging messages.
๐ฟStatic Class
This is a Static Class. Access it's methods directly with
.
. It's not possible to spawn new instances.๐งโ๐ปAPI Source
This page is auto-generated! The Functions, Properties and Events described here are defined in our GitHub's API Repository! Feel free to commit suggestions and changes to the source .json API files!
๐ย Examplesโ
(Console.Log) Basic
Console.Log("Hello, world!")
-- Outputs "Hello, world!"
(Console.Log) With formatting (string)
local player_name = "John"
Console.Log("Hello %s!", player_name)
-- Outputs "Hello John!"
(Console.Log) With formatting (integer)
local health = 50
local max_health = 100
Console.Log("Player health: %d/%d", health, max_health)
-- Outputs "Player health: 50/100"
(Console.RegisterCommand) Registering to a command that sends a message to everyone
Console.RegisterCommand("hello", function(text)
Console.Log("Sending a 'Hello %s' to everyone!", text)
Chat.BroadcastMessage("Hello " .. text)
end, "says a message to everyone", { "my_text" })
(Console.RunCommand) Running a Console Command
Console.RunCommand("hello")
(Console "PlayerSubmit" Event) Handles Console Inputs
Console.Subscribe("Console", function()
if (text == "some_text") then
Console.Log("Player submitted some_text!")
end
end)
๐ฟย Static Functionsโ
Returns | Name | Description | |
---|---|---|---|
Error | Logs a red error in the console with stack information | ||
Log | Logs and formats a message in the console | ||
RegisterCommand | Registers a new Console Command | ||
RunCommand | Runs a Console Command programmatically | ||
Warn | Logs an orange warning in the console with stack information |

Error
Logs a red error in the console with stack information, with formatted arguments
Console.Error(message, args...?)
Type | Parameter | Default | Description |
---|---|---|---|
string | message | Required parameter | Message to print |
any | args...? | nil | Other arguments to format with the message using string.format |

Log
Logs and formats a message in the console, with formatted arguments
Console.Log(message, args...?)
Type | Parameter | Default | Description |
---|---|---|---|
string | message | Required parameter | Message to print |
any | args...? | nil | Other arguments to format with the message using string.format |
Console.Log Examples
Basic
Console.Log("Hello, world!")
-- Outputs "Hello, world!"
With formatting (string)
local player_name = "John"
Console.Log("Hello %s!", player_name)
-- Outputs "Hello John!"
With formatting (integer)
local health = 50
local max_health = 100
Console.Log("Player health: %d/%d", health, max_health)
-- Outputs "Player health: 50/100"

RegisterCommand
Registers a new Console Command
Console.RegisterCommand(command, callback, description, parameters)
Type | Parameter | Default | Description |
---|---|---|---|
string | command | Required parameter | The command |
function | callback | Required parameter | The callback to be called when the command is inputted with this format |
string | description | Required parameter | The command description to display in the console |
table of string | parameters | Required parameter | The list of supported parameters to display in the console |
Console.RegisterCommand Examples
Registering to a command that sends a message to everyone
Console.RegisterCommand("hello", function(text)
Console.Log("Sending a 'Hello %s' to everyone!", text)
Chat.BroadcastMessage("Hello " .. text)
end, "says a message to everyone", { "my_text" })

RunCommand
Runs a Console Command programmatically
Console.RunCommand(command)
Type | Parameter | Default | Description |
---|---|---|---|
string | command | Required parameter | The command |
Console.RunCommand Examples
Running a Console Command
Console.RunCommand("hello")

Warn
Logs an orange warning in the console with stack information, with formatted arguments
Console.Warn(message, args...?)
Type | Parameter | Default | Description |
---|---|---|---|
string | message | Required parameter | Message to print |
any | args...? | nil | Other arguments to format with the message using string.format |
๐ย Eventsโ
Name | Description | |
---|---|---|
Close | When player closes the Console | |
LogEntry | Called when a log is received | |
Open | When player opens the Console | |
PlayerSubmit | Called when a console command is submitted |

Close
When player closes the Console
Console.Subscribe("Close", function()
-- Close was called
end)

LogEntry
Called when a log is received
Console.Subscribe("LogEntry", function(text, type)
-- LogEntry was called
end)

Open
When player opens the Console
Console.Subscribe("Open", function()
-- Open was called
end)

PlayerSubmit
Called when a console command is submitted
Console.Subscribe("PlayerSubmit", function(text)
-- PlayerSubmit was called
end)
Type | Argument | Description |
---|---|---|
string | text | Text submitted |
Console "PlayerSubmit" Event Examples
Handles Console Inputs
Console.Subscribe("PlayerSubmit", function(text)
if (text == "some_text") then
Console.Log("Player submitted some_text!")
end
end)