How can I detect is an install of my addon is new or an update? (Ace3)
I just noticed that if I change the default table given to AceDB it will also change for current installations of the addon when the user updates it.
This did upset a few user. How can I distinguish between update and new install. Is saving the addons version and then comparing it good idea? |
If I add a new variable to the default data table I just preset that value and add it to the existing data.
dataTable = dataTable or {} .. if dataTable is Empty set to default values .. Add new Data This way if they have installed a new addon with no data it will create it, if they already have data it will just add a default version of the new data. If you need them to reset their data for an update due to changes just make sure that information is provided in the patch file and/or main addon page so that they know they may need to go through their settings again. I think nUI used the version number system and had a function run through that checked which version was last used by the player and the new version and make any necessary changes to the data at that point before setting the new version as the new last used. Edit: After all that, I just noticed the Ace3 in the title rofl. I haven't used their library so can't help in that particular area. But hopefully someone will be able to help you. Good Luck. |
Quote:
It's magic, so any defaults that were not changed by the user are changed to the new version of your default table. I don't understand how users would get upset by that. It should be intended functionality Quote:
Yes you could probably try saving the addon version somewhere in the AceDB SavedVariables or a separate savedvar and then compare Not sure how you would not change any current installations while still being able to change the default table for newer versions unless you want to keep multiple versions around of your default table when passing it to AceDB |
Quote:
Quote:
|
The way I understand AceDB (I don't use it myself) is that it only stores settings a user has changed from the default. If a user is still using a default setting (even if just 1 out of 20), it won't bother to write that 1 to file.
It is good practice to give a lot of careful thought to what your default options are when creating them. It is not always a good idea to change those defaults on users unless you have a very good reason to do so. In this case, it is prudent to alert users that the defaults are changing. If the old default setting still exists as an option, they may be a touch inconvenienced, but can get it back to the way they are used to. |
Quote:
Code:
local defaults = { Code:
MyAddOnDB = { |
All times are GMT -6. The time now is 08:12 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI