What is wrong with this code?
I'm keeping this as simple as I can. This code is just a little counter that uses a right mouse button click to open a window that has a counter in it. The code works it just doesn't save the count. So my question is what is wrong with this code?
Lua Code:
|
The saved variable is a global. If you define a local with the same name, it won't access it.
|
Put the word local in front of lines 11 and 23, and remove the word local from line 3, if that is your saved variable.
|
Lua Code:
Everytime your addon loads this table would be used if it were global and not local. And when your saved variable is loaded which is nil by default it would delete it. When your main code runs your sv is not yet available. So you want to delay its use after an event that makes sure it is loaded. Typical is ADDON_LOADED (not sure if your implementation works ... as I dont see ZCount defined). And in repsonse to the event you'd use a construct like Lua Code:
This would make sure your sv is used when available. Edit: A quick read should bring more light to this topic http://wowpedia.org/AddOn_loading_process http://wowpedia.org/Saving_variables..._game_sessions A good choice to make sure your data is stored http://www.wowace.com/addons/ace3/pages/api/ace-db-3-0/ |
Quote:
|
Quote:
|
Wonder how I skipped over that. :rolleyes:
|
All times are GMT -6. The time now is 10:46 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI