Quantcast
WoWInterface - View Single Post - How could this be written neater?
View Single Post
05-09-17, 01:37 AM   #20
lightspark
A Rage Talon Dragon Guard
 
lightspark's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2012
Posts: 328
Originally Posted by Kanegasi View Post
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.
Been there, done that T_T Some devs are... Ugh
__________________
  Reply With Quote