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.Examples​
Console.RegisterCommand("hello", function(text)
Console.Log("Sending a 'Hello " .. text .. "' to everyone!")
Chat.BroadcastMessage("Hello " .. text)
end, "says a message to everyone", { "my_text" })
Static Functions​
Returns | Name | Description | |
---|---|---|---|
Log | Logs and formats a message in the console | ||
Warn | Logs an orange warning in the console | ||
Error | Logs a red error in the console | ||
RegisterCommand | Registers a new Console Command |
Log
​
Logs and formats a message in the console, with formatted arguments
Console.Log(message, args...?)
Type | Parameter | Default | Description |
---|---|---|---|
string | message | Message to print | |
any | args...? | nil | Other arguments to format with the message using string.format |
Warn
​
Logs an orange warning in the console, with formatted arguments
Console.Warn(message, args...?)
Type | Parameter | Default | Description |
---|---|---|---|
string | message | Message to print | |
any | args...? | nil | Other arguments to format with the message using string.format |
Error
​
Logs a red error in the console, with formatted arguments
Console.Error(message, args...?)
Type | Parameter | Default | Description |
---|---|---|---|
string | message | Message to print | |
any | args...? | nil | Other arguments to format with the message using string.format |
RegisterCommand
​
Registers a new Console Command
Console.RegisterCommand(command, callback, description, parameters)
Type | Parameter | Default | Description |
---|---|---|---|
string | command | The command | |
function | callback | The callback to be called when the command is inputted | |
string | description | The command description to display in the console | |
table of string | parameters | The list of supported parameters to display in the console |
Events​
Name | Description | |
---|---|---|
PlayerSubmit | Called when a console command is submitted | |
LogEntry | Called when a log is received | |
Open | When player opens the Console | |
Close | When player closes the Console |
PlayerSubmit
​
Called when a console command is submitted
Console.Subscribe("PlayerSubmit", function(text)
-- PlayerSubmit was called
end)
Type | Argument | Description |
---|---|---|
string | text |
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)
Close
​
When player closes the Console
Console.Subscribe("Close", function()
-- Close was called
end)