Skip to main content

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.
💂Authority
This static class can be accessed on both 🟧 Client and 🟦 Server side.

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​

ReturnsNameDescription
LogLogs and formats a message in the console
WarnLogs an orange warning in the console
ErrorLogs a red error in the console
RegisterCommandRegisters a new Console Command

Log​

Logs and formats a message in the console, with formatted arguments

Console.Log(message, args...?)
TypeParameterDefaultDescription
stringmessageMessage to print
anyargs...?nilOther arguments to format with the message using string.format

Warn​

Logs an orange warning in the console, with formatted arguments

Console.Warn(message, args...?)
TypeParameterDefaultDescription
stringmessageMessage to print
anyargs...?nilOther arguments to format with the message using string.format

Error​

Logs a red error in the console, with formatted arguments

Console.Error(message, args...?)
TypeParameterDefaultDescription
stringmessageMessage to print
anyargs...?nilOther arguments to format with the message using string.format

RegisterCommand​

Registers a new Console Command

Console.RegisterCommand(command, callback, description, parameters)
TypeParameterDefaultDescription
stringcommandThe command
functioncallbackThe callback to be called when the command is inputted
stringdescriptionThe command description to display in the console
table of stringparametersThe list of supported parameters to display in the console

Events​

NameDescription
PlayerSubmitCalled when a console command is submitted
LogEntryCalled when a log is received
OpenWhen player opens the Console
CloseWhen player closes the Console

PlayerSubmit​

Called when a console command is submitted
Console.Subscribe("PlayerSubmit", function(text)
-- PlayerSubmit was called
end)
TypeArgumentDescription
stringtext

LogEntry​

Called when a log is received
Console.Subscribe("LogEntry", function(text, type)
-- LogEntry was called
end)
TypeArgumentDescription
stringtextLog Message
LogTypetypeType of the log

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)