🔤 Console
Exposes access to registering Console Commands and Logging messages
🎒 Examples
Console.Log("Hello, world!")
-- Outputs "Hello, world!"
local player_name = "John"
Console.Log("Hello %s!", player_name)
-- Outputs "Hello John!"
local health = 50
local max_health = 100
Console.Log("Player health: %d/%d", health, max_health)
-- Outputs "Player health: 50/100"
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("hello")
Console.Subscribe("PlayerSubmit", function(text)
if (text == "some_text") then
Console.Log("Player submitted some_text!")
end
end)
🗿 Static Functions
Debug | Logs a debug message in the console, with formatted arguments. Outputted only when the current log level is Debug or Verbose | |
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 (only scripting-registered commands can be triggered) | |
Subscribe: function | Subscribes to an Event | |
Unsubscribe | Unsubscribes from all subscribed Events in this Class and in this Package, optionally passing the function to unsubscribe only that callback | |
Warn | Logs an orange warning in the console with stack information |

DebugOptimal
Logs a debug message in the console, with formatted arguments. Outputted only when the current log level is Debug or Verbose
Console.Debug(message, args...?)

ErrorOptimal
Logs a red error in the console with stack information
The message is formatted with the given arguments
Console.Error(message, args...?)

LogOptimal
Logs and formats a message in the console
The message is formatted with the given arguments
Console.Log(message, args...?)
Parameters
| Name | Type | Descrição |
|---|---|---|
message | string | Message to print |
args...? | any | Other arguments to format with the message using string.format Default nil |
Examples (3)
Console.Log("Hello, world!")
-- Outputs "Hello, world!"
local player_name = "John"
Console.Log("Hello %s!", player_name)
-- Outputs "Hello John!"
local health = 50
local max_health = 100
Console.Log("Player health: %d/%d", health, max_health)
-- Outputs "Player health: 50/100"

RegisterCommandOptimal
Registers a new Console Command
Console.RegisterCommand(command, callback, description?, parameters?)
Parameters
| Name | Type | Descrição |
|---|---|---|
command | string | The command |
callback | function | The callback to be called when the command is inputted with this format |
description? | string | The command description to display in the console Default |
parameters? | table of string | The list of supported parameters to display in the console Default {} |
Examples (1)
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" })

RunCommandModerate
Runs a Console Command programmatically (only scripting-registered commands can be triggered)
Console.RunCommand(command)
Parameters
| Name | Type | Descrição |
|---|---|---|
command | string | The command |
Examples (1)
Console.RunCommand("hello")

SubscribeOptimal
Subscribes to an Event
local ret = Console.Subscribe(event_name, callback)
Parameters
| Name | Type | Descrição |
|---|---|---|
event_name | string | Event to subscribe to |
callback | function | Callback to run on the event occurring |
Returns
| Type | Descrição |
|---|---|
| function | The function callback |

UnsubscribeOptimal
Unsubscribes from all subscribed Events in this Class and in this Package, optionally passing the function to unsubscribe only that callback
Console.Unsubscribe(event_name, callback?)

WarnOptimal
Logs an orange warning in the console with stack information
The message is formatted with the given arguments
Console.Warn(message, args...?)
🚀 Events
LogEntry | Called when a log is received | |
PlayerSubmit | Called when a console command is submitted |

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

PlayerSubmit
Called when a console command is submitted
Console.Subscribe("PlayerSubmit", function(text)
-- PlayerSubmit was called
end)
Arguments
| Name | Type | Descrição |
|---|---|---|
text | string | Text submitted |
Examples (1)
Console.Subscribe("PlayerSubmit", function(text)
if (text == "some_text") then
Console.Log("Player submitted some_text!")
end
end)

