Talk:Event system: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (Created page with 'Just an observation: it seems that the hidden variables (like source) persist throughout the duration of the associated event handler, including while other functions (that were …')
 
No edit summary
 
Line 1: Line 1:
Just an observation: it seems that the hidden variables (like source) persist throughout the duration of the associated event handler, including while other functions (that were called by the handler function) are being executed. This means that the hidden the variables work quite differently than do function arguments, and there is potential for errors if the user does is not aware of this fact. Perhaps the way these hidden variables work should be explained on the page - their scope and when they exist. --[[User:Erorr404|Erorr404]] 03:58, 11 August 2009 (UTC)
Just an observation: it seems that the hidden variables (like source) persist throughout the duration of the associated event handler, including while other functions (that were called by the handler function) are being executed. This means that the hidden the variables work quite differently than do function arguments, and there is potential for errors if the user does is not aware of this fact. Perhaps the way these hidden variables work should be explained on the page - their scope and when they exist. --[[User:Erorr404|Erorr404]] 03:58, 11 August 2009 (UTC)
: The so-called 'hidden' variables are global variables that are set when the event-handling function is called, and unset when the function returns. As such, as you say, their scope is across any functions called by the event-handling function. This possible is useful in some circumstances, though I'd guess it causes more issues than it solves. [[User:EAi|eAi]] 09:55, 11 August 2009 (UTC)

Latest revision as of 09:55, 11 August 2009

Just an observation: it seems that the hidden variables (like source) persist throughout the duration of the associated event handler, including while other functions (that were called by the handler function) are being executed. This means that the hidden the variables work quite differently than do function arguments, and there is potential for errors if the user does is not aware of this fact. Perhaps the way these hidden variables work should be explained on the page - their scope and when they exist. --Erorr404 03:58, 11 August 2009 (UTC)

The so-called 'hidden' variables are global variables that are set when the event-handling function is called, and unset when the function returns. As such, as you say, their scope is across any functions called by the event-handling function. This possible is useful in some circumstances, though I'd guess it causes more issues than it solves. eAi 09:55, 11 August 2009 (UTC)