View Single Post
03-07-10, 11:51 AM   #4
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,934
Ah, kinda makes sense.

But when do you initialise the nUI_Options ?

All my addons initialise the saved variables with the default values outside of the functions themselves and thus before the saved variables are loaded and replace these defaults. I've never had a problem like this with that data that way.

Say for example:

MyAddon.lua in wtf folder
SVData["Table1"] = {
Item1 = "SavedVariable"
};

MyAddon_SVData.lua
SVData["Table1"] = {};
SVData["Table1"].Item1 = "SomeTextHere";
etc

MyAddon.lua - loaded after MyAddon_SVData.lua is processed
function OnEvent()
Event = PlayerLogin
SVData["Table1"].Item1 would = "SomeTextHere"
Event = LoadVariables
SVData["Table1"].Item1 would = "SavedVariable"
end

This way the addon doesn't bomb out but will use the default values until the saved variables are loaded into memory. It's the way I have always dealt with saved variables and I have yet to have any of my data tables show up as nil ... *touches wood*
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818