View Single Post
12-28-17, 10:56 PM   #17
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
Originally Posted by JDoubleU00 View Post
I'm curious, wouldn't I need these two lines? Otherwise, it seems that line two would always wipe the saved variable.

AddonListDB = AddonListDB or {}
addonlistdb = AddonListDB
I'm not sure what you are trying to achieve or may have planned to-do so much of my thinking is just a "stab in the dark".

Consider, you login one day with 24 addons, you exit. The next day you decide you only need 17 of them. Keeping the SavedVariable information from the previous day intact means that slots 18-24 will contain stale and possibly duplicate (possibly incorrect) information as they won't be overwritten using the new list of only 17 addons. Wiping the table each time means you have current data.

With the code you've given,
Code:
local addonlistdb
...
addonlistdb = AddonListDB
so far is not needed as you have been writing directly to AddonListDB (addonlistdb is just a pointer to AddonListDB, not a copy of the table)
Code:
AddonListDB = AddonListDB or {}
is all you need if you want to preserve the data between sessions.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 12-28-17 at 11:17 PM.
  Reply With Quote