You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The reason will be displayed to describe this comment to others. Learn more.
I don't think this will fix it because it did not trigger at all. My example used outputDebugString but I also tested it with outputChatBox and it does not show up.
The reason will be displayed to describe this comment to others. Learn more.
Ok so the problem that caused me to think this was bugged was because the arguments passed must have changed when a script fails to load or I made an edit to my script and broke it not handling when file argument is nil. My script was passing this nil variable to a function that returns an error when it gets nil and I never knew this because debugs don't show up that are occuring inside onDebugMessage, so yeah if this fix allows debug messages to show up inside the debug message event, it should avoid any confusion for scripters when they have errors inside their debug handler.
The reason will be displayed to describe this comment to others. Learn more.
This commit only fixes usage of outputDebugString/iprint in the on(Client)DebugMessage handler, before this commit, these functions wouldn't show anything there, when called inside the event handler. Also, outputDebugString/iprint won't trigger on(Client)DebugMessage again, when called from that event handler.
81b64e3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this will fix it because it did not trigger at all. My example used outputDebugString but I also tested it with outputChatBox and it does not show up.
81b64e3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does
wasEventCancelled()
say before this fix?81b64e3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually on further testing, it did output to chatbox, but I didn't notice it because I did:
addEventHandler("onDebugMessage", root, function(msg, lvl, file, line) outputChatBox(msg..", "..lvl..", "..file..", "..line) end)
And file and line are both nil so there was an error in that line but it wouldn't show up until I used tostring:
srun addEventHandler("onDebugMessage", root, function(msg, lvl, file, line) outputChatBox(tostring(msg)..", "..tostring(lvl)..", "..tostring(file)..", "..tostring(line)) end)
So I guess this fix would work.
81b64e3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok so the problem that caused me to think this was bugged was because the arguments passed must have changed when a script fails to load or I made an edit to my script and broke it not handling when file argument is nil. My script was passing this nil variable to a function that returns an error when it gets nil and I never knew this because debugs don't show up that are occuring inside onDebugMessage, so yeah if this fix allows debug messages to show up inside the debug message event, it should avoid any confusion for scripters when they have errors inside their debug handler.
81b64e3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This commit only fixes usage of outputDebugString/iprint in the on(Client)DebugMessage handler, before this commit, these functions wouldn't show anything there, when called inside the event handler. Also, outputDebugString/iprint won't trigger on(Client)DebugMessage again, when called from that event handler.