OnDebugMessage: Difference between revisions
Jump to navigation
Jump to search
(Added RGB params) |
m (→Parameters) |
||
Line 14: | Line 14: | ||
}} | }} | ||
*'''message''': | *'''message''': the message which was outputted in the server console, without details like file, line etc. | ||
*'''level''': | *'''level''': the type of debug message which was outputted. | ||
**'''0:''' "Custom" message | **'''0:''' ''"Custom"'' message. | ||
**'''1:''' Error message | **'''1:''' ''Error'' message. | ||
**'''2:''' Warning message | **'''2:''' ''Warning'' message. | ||
**'''3:''' Information message | **'''3:''' ''Information'' message. | ||
*'''file''': | *'''file''': the file from which the debug message was outputted. | ||
**'''Note:''' | **'''Note:''' may return [[nil]] when the source could not be found. | ||
*'''line''': | *'''line''': the line in file '''file''' where the debug message was outputted. | ||
**'''Note:''' | **'''Note:''' may return [[nil]] when the source could not be found. | ||
{{New items|5.0154|1.5.4-9.11412| | {{New items|5.0154|1.5.4-9.11412| | ||
*'''r''': | *'''r''': an [[int]] representing the amount of red color (0-255). | ||
*'''g''': | *'''g''': an [[int]] representing the amount of green color (0-255). | ||
*'''b''': | *'''b''': an [[int]] representing the amount of blue color (0-255). | ||
}} | }} | ||
Revision as of 22:11, 2 April 2018
This event is triggered when debug messages (for instance errors or warnings) appear in the server console.
Parameters
string message, int level, string file, int line
- message: the message which was outputted in the server console, without details like file, line etc.
- level: the type of debug message which was outputted.
- 0: "Custom" message.
- 1: Error message.
- 2: Warning message.
- 3: Information message.
- file: the file from which the debug message was outputted.
- Note: may return nil when the source could not be found.
- line: the line in file file where the debug message was outputted.
- Note: may return nil when the source could not be found.
Source
The source of this event is the root element.
Example
This example outputs all debug messages to the chat box with the same colouring.
addEventHandler("onDebugMessage", getRootElement(), function(message, level, file, line) if level == 1 then outputChatBox("ERROR: " .. file .. ":" .. tostring(line) .. ", " .. message, getRootElement(), 255,0,0) elseif level == 2 then outputChatBox("WARNING: " .. file .. ":" .. tostring(line) .. ", " .. message, getRootElement(), 255,165,0) else outputChatBox("INFO: " .. file .. ":" .. tostring(line) .. ", " .. message, getRootElement(), 0,0,255) end end)
See Also
Server events
Event functions
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled