View Single Post
03-03-13, 12:49 PM   #13
ravagernl
Proceritate Corporis
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 1,176
Originally Posted by Mayron View Post
Also in your "frame:SetScript("OnEvent", function(self, event, ...)" part of the script, the "frame" comes up as a nil variable when I run it in wow. Is that because I am meant to rename the "frame" to any other frame that preferably is not already using an OnEvent script and which is always showing such as the "block" frame that does not disappear until the very end? Either that or some how defining "frame" as an actual variable then.
Yes, or use "local frame = CreateFrame("Frame")" and paste that above it.

Edit: It is also saying that this line:

Code:
if _G[addon].db:GetCurrentProfile() == "MayronUI" then
that "db" is a nil value with a lua error for some reason
That would probably be because "OtherAddon" or "AnotherAddon" (noted in the loop as the variable "addon") does not exist in the global environment (_G), or because it does not have a db property, or because it has a db property but the db property is not a AceDB profile database.

One way to solve it:
lua Code:
  1. local addon
  2.         for _, addonName in pairs(addons) do
  3.             addon = _G[addonName]
  4.             print(addon and addonName .. " was detected." or addonName .. " was not detected.")
  5.             if addon and addon.db and addon.db.GetCurrentProfile and addon.db.GetCurrentProfile() == "MayronUI" then
  6.                 setupMode = "bonus"
  7.                 -- Some debug here, always test!
  8.                 print(addonName .. " database was detected.")
  9.                 break
  10.         end

Last edited by ravagernl : 03-03-13 at 12:53 PM.
  Reply With Quote