Yes and no. I've not yet found the pattern for what is the right way to describe what happens sometimes during the loading process.
But I think its safe to say there is something not always the way we expect it
I get the best results when I check for the event that comes first addon_loaded or player_login. I know that normally player_login cant occur before addon_loaded still this construct helps me to not run in the problem you describe. PLAYER_ENTERING_WORLD is the event I found the most reliable point for data validity. But I feel bad when I use it instead of addon_loaded for initializing my addons
lua Code:
local name, addon = ...
local f = CreateFrame("Frame")
local login = true
local function onevent(self, event, arg1, ...)
if(login and ((event == "ADDON_LOADED" and name == arg1) or (event == "PLAYER_LOGIN"))) then
login = nil
f:UnregisterEvent("ADDON_LOADED")
f:UnregisterEvent("PLAYER_LOGIN")
init()
end
end
f:RegisterEvent("ADDON_LOADED")
f:RegisterEvent("PLAYER_LOGIN")
f:SetScript("OnEvent", onevent)
Edit:
btw variables loaded:
Until 3.0, VARIABLES_LOADED used to fire upon completion of the addon loading process; since 3.0, it is fired in response to CVars, Keybindings and other associated "Blizzard" variables being loaded, and may therefore be delayed until after PLAYER_ENTERING_WORLD. The event may still be useful to override positioning data stored in layout-cache.txt
|
http://www.wowpedia.org/AddOn_loading_process