View Single Post
09-29-16, 09:33 PM   #14
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Ah, I think I know what the problem is. In order to figure out what region you're playing in, LibRealmInfo needs to look at your character's GUID, which isn't available before the login process is finished. Try wrapping the code up like this:

Code:
local f = CreateFrame("Frame")
f:RegisterEvent("PLAYER_LOGIN")
f:SetScript("OnEvent", function()
     -- all the other code here
end)
This will delay running the rest of the code until the login process is complete.

Re: The message spam, I forgot about that... the library is designed to be embedded in the addon using it, so if it's installed as a standalone addon, it assumes you're a developer and want debugging info. The simplest way to fix that is to move the LibRealmInfo.lua file from the LibRealmInfo folder into your addon's folder, then add a line reading "LibRealmInfo.lua" in your addon's TOC file, just before the line that names your addon's Lua file. Then you can delete the LibRealmInfo addon folder.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote