outputDebugString
Client-side
Server-side
Shared
Manual Review Required
Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.
This function outputs scripting debug messages, which can be read by enabling the debug textbox. The debug display level can then be set so that info or warning messages get filtered out.
Note
Color values are only applied when debug level is 0 or 4.
Syntax
bool outputDebugString ( string text, [ int level = 3, int red = 255, int green = 255, int blue = 255 ] )Required Arguments
- text: the text to be output to the debug box.
Optional Arguments
NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use.
- level (default: 3): the debug message level. Possible values are: 0: Debug message 1: Error message 2: Warning message 3: Information message (default) 4: Custom message (omits file path and line number)
- red (default: 255): The amount of red in the color of the text. Default value is 255.
- green (default: 255): The amount of green in the color of the text. Default value is 255.
- blue (default: 255): The amount of blue in the color of the text. Default value is 255.
Returns
- bool: value
Returns true if the debug message was successfully output, false if invalid arguments are specified.
Code Examples
shared
This script notifies when its resource has been loaded using a debug message:
function resourceStartNotify ( resourcename ) -- if the started resource is this one if ( resourcename == getThisResource() ) then -- send an info debug message as a notification outputDebugString ( "Resource " .. getResourceName(resourcename) .. " loaded." ) endendaddEventHandler( "onResourceStart", root, resourceStartNotify )