Help with Loading and Using Saved Variables
So im trying to load and use the saved varables for my addon.
Here is the current lua code: Code:
local addon, sActionbars = ... Code:
<Ui xmlns="http:\\www.blizzard.com\wow\ui\" xmlns:xsi="http:\\www.w3.org\2001\XMLSchema-instance" xsi:schemaLocation="http:\\www.blizzard.com\wow\ui\ ..\FrameXML\UI.xsd"> Code:
1x sActionbars\sActionbars-8.1.0.lua:36: attempt to index global 'sActionbarsDB' (a nil value) Thanks Coke |
sActionbarsDB={} needs to be at the very top of the file, the addon load process will fill it in.
As for the actual saving, do you have it in your .toc file? |
Quote:
Code:
## Interface: 80100 |
I am missing the lua files(s) in the toc.
|
Quote:
Code:
<Ui xmlns="http:\\www.blizzard.com\wow\ui\" xmlns:xsi="http:\\www.w3.org\2001\XMLSchema-instance" xsi:schemaLocation="http:\\www.blizzard.com\wow\ui\ ..\FrameXML\UI.xsd"> |
You're executing
Code:
local hotkeyAlpha = sActionbarsDB.showHotKeys and 1 or 0 Code:
if ( sActionbarsDB == nil ) then You could create local hotkeyAlpha as a nil variable at the top of the file and then initialise it after testing for the SV in the event but then you woulld still have to move the setup code into the event as well. If you move all the ADDON_LOADED code into PLAYER_LOGIN and do everything there then you only have one event to worry about (no name test or unregister required as it only fires once after all ADDON_LOADED events and before PLAYER_ENTERING_WORLD) and you know that, by then, the game has loaded your SavedVariables, if they exist yet. Lua Code:
|
Thanks Fizzlemizz for the stucture help,
For now i went back to basics sence im not sharing the addon/addons with anyone and i dont change my settings i just hard coded them in without the need of option tables Thanks again Coke |
All times are GMT -6. The time now is 06:46 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI