When your saved variables are fresh (i.e. GUB.MainDB is empty), AceDB generates .profile the moment you try to get it using the metatable. This is why AceDB fires "OnNewProfile" when you get GUB.MainDB.profile for the first time.
By the way, you should use addon:OnInitialize, that is called only once by AceAddon-3.0, instead of using OnEnable + an initOnce value.
Basically, with AceDB-3.0 you should never tinker with the saved variable nor the defaults directly. If you have something to handle by youtself, like the version, do not put it into the default.
The other solution is to recognize the version of the variables by checking its content instead of a version field so you wouldn't have to bother with OnNewProfile.
- Curse Premium
Member for 11 years, 2 months, and 16 days
Last active Thu, Sep, 12 2019 17:20:59
- 1 Follower
- 2,404 Total Posts
- 0 Thanks
Nov 6, 2013I wasn't aware it fires both OnProfileChanged and OnNewProfile in that order. Anyway, since my upgrade function is idempotent, this is a non-issue. And for calling ApplyProfile twice, it's a bit annoying but I don't think this is something to bother with, unless the player creates a couple profile every seconds during combat...Posted in: Ace3
Nov 5, 2013Several of my addons had to deal with profile upgrading. Here are two ways of handling this :Posted in: Ace3
1) with a "version" field in the profile : http://www.wowace.com/paste/8815/
2) using a idempotent upgrade method : http://www.wowace.com/paste/8816/
In both case you have to handle the old defaults in the upgrading process.
Nov 3, 2013Posted in: Ace3Quote from DridztIn this particular case (the original addon I'm working on, not the stripped down example code I posted to illustrate this particular issue) the button widgets are added based on a dynamic list and the icon widget needs to anchor to any one of them, not a particular one.
If I wanted to have it be next to button no2 always then doing :AddChild() in the 'proper order' and letting the layout do its job would be sufficient but like I said the anchoring is volatile.
How do you choose which button the icon should be anchored too ? ???
Nov 3, 2013IIRC, one of the objectives of AceGUI is the automated layouts ; another one being recycling widgets.Posted in: Ace3
You can add new layouts algorithm using AceGUI:RegisterLayout("layoutId", function(content, children) ... end). The function is called each time the container is resized. You can change the layout of a container with container:SetLayout("layoutId").
Oct 28, 2013I have discussed with Stanzilla on the IRC channel. This should be fixed by the latest alpha.Posted in: Libraries
Since LibMounts-1.0 gets most of this data from the game API introduced some patches ago, addons and the library should wait until those data are available. The original implementation waited for PLAYER_LOGIN, but it seemed it wasn't sufficient with some clients.
Oct 23, 2013Posted in: Lua Code DiscussionQuote from Archarodim
Also note that many other popular add-ons (Auctioneer for example) implements their own bug grabbing mechanism which will prevent the embedded buggrabber to initialize. In Decursive when bugGrabber is not available I'll register my own error handler to grab errors (using seterrorhandler() ) and do my best to forward them to other handlers
Why did you embed BugGrabber if you also had to implement your own error handler ?
Oct 20, 2013Hello,Posted in: Lua Code Discussion
I'm getting tired of reports like "[addon] stopped working" or "[addon] is causing major fps drop", that generally indicate hidden errors. Asking the reporting user to enable Lua error display or to install an error handling addon is useless in most cases.
So I wonder about embedding BugGrabber in some of my addons. I was thinking about adding a small home-brew error handler but BugGrabber already does it pretty well, see the file embedding.txt in the !BugGrabber folder. I would indicate this on the addon main page so people would know (yes, I know people won't read and complain anyway).
Any thought on this ?
Oct 4, 2013Posted in: Need Help?Quote from Phanxthere is also a limit on the number of locals you can have.
I didn't know. Is this documented somewhere ?
Quote from Phanx(4) I'm not really sure why you're using an OnUpdate at all. It looks like you're just reporting when you see a rare mob if nobody else has already reported it, in which case you should just report it right away, instead of waiting some random small amount of time first.
If the event is detected simultaneously by several players using the same addon, they will all announce it to the general channel, resulting in some spam. By adding a small random delay, the announces are spread in time. The first one will shut the other ones, since the addon also watches the channel for such announces.
Oct 3, 2013If you want some example of world/mini-map display, take a look at Gathermate2. Some parts are definitively deeply tied to Gathermate2 and should be refactored but the whole thing worths looking at. And it's GPL'd.Posted in: Libraries
I have been thinking about two addons who could use such library. I wrote one of them but it just shoehorns its points into Gathermate (which allows it though it lacks a few API). This is what I would expect :
- handle a separate database par addon (or even several databases per addon : identify database with an arbitrary keys, which happens to be the addon table when the library is embedded. See how AceEvent handle this),
- define pin categories (associate labels and icons to keys),
- add pin to any map,
- remove any pin ,
- show/hide all pins,
- clear all pins,
- provide some callbacks for user interaction (onEnter, onLeave, onClick) for both minimap and worldmap pins,
- (optional or configurable) display pins only on either worldmap or minimap,
- (optional or configurable) display nearby pins on minimap border,
- (optional or configurable) hide/change minimap pins when the player gets closer to them.
I'm not sure about point categories. It fits addons like gathermate that handles several points with the same labels and icons but it could be awful for addon handling unique points.
- To post a comment, please login or register a new account.