Originally Posted by lightspark
That's why I said what I said, I do it because of my paranoia, and I have it because I've seen shit. Being paranoid is kinda foolish.
I agree w/ you and I also said that there's almost no need to create any upvalues in 99.99% of cases. Basically, my comment was "do as I say, not as I do"
P.S. I prob should start fighting _G-paranoia though....
|
I can fully understand code paranoia. During a testing phase of Decliner, the friend helping me said it didn't work. After some investigation, having them use /dump on my main player check function returned nil, but it returned a function for me. I double-checked they were using the exact same /dump string and that my addon was loaded.
My answer was to move the check function to a local and then make a global dummy function that returns the check function. The worst part was the integration into a timer loop I use to check the global dummy every five seconds and reinitialize it if it's nil, while trying to out the addon deleting it with ADDON_LOADED. I recently removed that part of the timer loop actually, but I still hide the main check function locally, while the global dummy is just an API thing I keep.
Paranoia aside, I still learned that I shouldn't have important functions outside my addon's scope.