Debug
Debug is a global class that provides access to various debugging functions which are useful for testing and debugging your scripts.
warning
Some of these functions can have a notable impact on performance if used in frame or gametick-based functions
Functions
Function | Description |
---|---|
Print | Writes a message out to the script console. |
Warn | Writes a warning out to the script console. |
Error | Writes an error out to the script console. |
Watch | Adds a static value or a table to the watch panel in the script console. |
ClearWatch | Stops watching a static value or table. |
Debug:Print(message)
Writes a message out to the script console.
Parameters
Parameter | Type | Description |
---|---|---|
message | string | The message to write out to the console. |
Usage
script.lua
Debug:Print("Logging something")
Debug:Warn(message)
Writes a warning out to the script console.
Parameters
Parameter | Type | Description |
---|---|---|
message | string | The warning message to write out to the console. |
Usage
script.lua
Debug:Warn("Oh no, something happened")
Debug:Error(message)
Writes an error out to the script console.
Parameters
Parameter | Type | Description |
---|---|---|
message | string | The error message to write out to the console. |
Usage
script.lua
Debug:Error("Oh no, something very bad happened")
Debug:Watch(key, value)
Adds a static value or a table to the watch panel in the script console.
Parameters
Parameter | Type | Description |
---|---|---|
key | string | The key to show in the watch panel. |
value | table | The value or table to watch. |
Usage
script.lua
MyTable = {}
Debug:Watch("My Table", MyTable)
TODO: Add watch table pic here
Debug:ClearWatch(key)
Stops watching a static value or table.
Parameters
Parameter | Type | Description |
---|---|---|
key | string | The key used when calling Debug:Watch . |
Usage
script.lua
MyTable = {}
Debug:Watch("My Table", MyTable)
-- some time later...
Debug:ClearWatch("My Table")