Thread: AceDB Resetting
View Single Post
08-08-16, 07:22 AM   #5
MilleXIV
A Deviate Faerie Dragon
 
MilleXIV's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2016
Posts: 16
Originally Posted by myrroddin View Post
Okay, before I go deeper into your initial problem, here's some feedback:
  1. Having a global variable named "P" is near catastrophic. Make that a local variable.
  2. With LibSharedMedia, do not localize the media name. It won't be localized for anyone who is using a different AddOn than the one you are writing, and will most likely break LSM for other users.
  3. Get rid of embeds.xml. It was only used years ago by the AceUpdater, which is long defunct. Plus your ToC is loading a file, which in turn is loading more files. Just put all your library lookups directly into the ToC.
  4. There is no need to localize the word "Profiles"; AceConfig will do that for you.
  5. Move the creation of self.frames from OnEnable to OnInit. You only need to create the table once.
I'm sure there is more, and what I mentioned doesn't fix your actual problem, but it's a start.
Good feedback. This is my first time using the Ace libraries so I'm still getting used to them.
  1. Good catch, didn't even realize I had left it global
  2. That was more a weird preference for not having output strings in the middle of code, but considering how AceLocale works, that was basically useless
  3. Is there any disadvantage to using embeds.xml other than the file loading overhead? I like the idea of keeping my libraries listed in one separate file
  4. Huh, I was not aware it did that. Good to know.
  5. Fixed. How often is OnEnable called? Should I worry about it running too often?
  Reply With Quote