Need help with loading SavedVariables
Hi guys. Have a little problem with loading my saved vars.
Looks like saved vars are always replaced with their default values, but values I save to saved variables are saved normally. Just can't load. Any ideas how to fix it? Loading method is below. Lua Code:
|
What are you setting the variable 'version' to?
If you're not, and it's passing through nil, then it'll always replace the SV with a fresh set. Set the version to 1, and it will save |
Quote:
Interesting observation: If I load these values after my addon loaded, they are loaded fine. :confused: |
Could it be ", nil)" at the last part of the variable initialization?
|
Found it. :banana:
My addon initialize was triggered from XML. I changed it to LUA and it works fine now. Looks like there's a slight difference in way of initializing your addon. Lesson for me :) |
It'll be easier if we can see both the lua file and the addon.txt file
|
Quote:
|
Quote:
|
It's risky doing much of anything prior to addon load. There are, I believe, four ZO_ addons that load first. They are defined, their files load first, but who knows how they function. Zo_SavedVars seems a prime example. It exists, you can call it, you don't get any errors, but the data it uses isn't there yet so it doesn't behave correctly until those ZO_ addons load. Using the API prior to addon load is at your own risk. Who knows the state of the game, what data is populated from the server yet or not and such. Creating controls is strictly client and it doesn't rely upon server data to do that. The data displayed by a control may be a whole different story though.
|
All times are GMT -6. The time now is 09:07 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI