Skip to content

Global Class "Console"⚓︎

Info

You can get this class by using the Console global table.

Note that to call these functions, you must use a . (period) instead of a : (colon)!

Example Code
1
local cmdhistory = Console.GetCommandHistory()

Functions⚓︎

GetCommandHistory ()⚓︎

string[] GetCommandHistory ( )⚓︎

Returns a table containing current command history.


GetHistory ()⚓︎

string[] GetHistory ( )⚓︎

Returns a table containing every previous entry printed to the console this run.

This is ordered last-to-first- the first entry will be the currently blank line awaiting user input, followed by the previous print, and so on. The last line will always be Repentance Console.


PopHistory ()⚓︎

void PopHistory ( int Amount = 1 )⚓︎

Removes previous lines from history. Optionally, use amount to define how many entries should be removed. The line currently awaiting user input in the console counts as a part of the history, but this is already accounted for on the C++ side.


PrintError ()⚓︎

void PrintError ( string Error )⚓︎

Prints an error to the console, errors display in red text.


PrintWarning ()⚓︎

void PrintWarning ( string Warning )⚓︎

Prints a warning to the console, warnings display in yellow text.


RegisterCommand ()⚓︎

void RegisterCommand ( string Name, string Desc, string HelpText, boolean ShowOnMenu, AutocompleteType Type )⚓︎

Registers a command in the new console. These will show up in the new console's autocomplete.

  • Desc will show when typing the help command.
  • HelpText will show when typing help (Name).
  • AutocompleteType will make the command inherit that autocomplete type. If the command doesn't fit into any of the standard types, use CUSTOM combined with MC_CONSOLE_AUTOCOMPLETE to create a bespoke one for this command.

RegisterMacro ()⚓︎

void RegisterMacro ( string Name, string[] Commands )⚓︎

Registers a macro in the new console. These will show up in the new console's autocomplete for the macro command.

  • Commands is a table of strings containing the commands that should be executed, in order.