What is the best practice to apply savedvariabled
Can anyone explain me what the best practice is to apply the savedvariables between a interface reload/logon of the game.
Currently I call all my addons functions when the addon is loaded again. For example my addons enabled you to rearrange the actionbar buttons. When the ui reloads they will reset to the games default position. I then call the function that set their pos based on the users saved variables. Another one for example hides the keybind text. Do I call each function after the addon is loaded? (I have searched the wiki and the forum before posting this :o) |
You should simply wait for the EVENT_ADD_ON_LOADED before doing anything. When that fires, you can be certain that the saved vars have been loaded.
Lua Code:
|
Yes I'm doing that, so in that function I placed my functions with the paramaters pointing to the savedvars. It's normal for every Addon to basically have to reapply the settings for the addon to the users interface?
|
And in addition EVENT_PLAYER_ACTIVATED will fire as all was loaded and you are ready "to run" with your char ingame.
It will even fire after a reloadui, zone changes and other things where a loading screen appears. Hint: The chat will be ready for output after this event has fired! So debug messages you send to the chat before (e.g. at EVENT_ADD_ON_LOADED) cannot be seen in the chat, except you use other libraries (LibDebugLogger) with it's own UI (DebugLogViewer) or addons like pChat which enable a history to buffer send messages before player activated event -> showing the cached messages then. |
Quote:
|
Quote:
|
All times are GMT -6. The time now is 08:28 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI