Jump to content
Sign in to follow this  
ianbanks

Article on how private variables behave and when they misbehave

Recommended Posts

Private variables in SQF can be pretty confusing, especially with misleading statements like this in the Biki:

 

"Local variables are only visible in a specific script. The whole code in this script has access to the variable, that includes also functions called within the script."

 

Once you try adding an event handler that has references to private variables, as one example, you'll discover it isn't quite as the above suggests. I'm hoping with this article that a mental model–that matches more closely how the SQF engine actually works with private variables–will help people out:

 

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×