Talk:Event system

From Multi Theft Auto: Wiki

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)