WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=3)
-   -   Portrait dropdown help (https://www.wowinterface.com/forums/showthread.php?t=20429)

Felankor 02-05-09 03:17 PM

Portrait dropdown help
 
Hi,

Something changed in 3.0.8 which is causing an error in my addon. I can't fix it because I can't find what has changed.

I'm getting the following error:
Code:

attempt to index local 'dropdownFrame' (a nil value)
Heres the code:
Code:

local dropdownFrame = getglobal(UIDROPDOWNMENU_INIT_MENU);
local name = dropdownFrame.name; --<<<<<< This is the line with the error
local button = this.value;

Can anyone tell me how to fix it, or atleast what's changed to cause this error so I can try to work out how to fix it myself.

Thanks in advance

Felankor

Tuhljin 02-05-09 04:34 PM

UIDROPDOWNMENU_INIT_MENU points to the actual frame instead of the frame's name, now. Try this:
Code:

local dropdownFrame = UIDROPDOWNMENU_INIT_MENU;

Mera 02-05-09 05:20 PM

this wont work Tuhl this is

Code:

local dropdownFrame = getglobal(UIDROPDOWNMENU_INIT_MENU);
local name = dropdownFrame:GetName()

or

Code:

local name = _G["UIDROPDOWNMENU_INIT_MENU"]:GetName()

Felankor 02-06-09 02:52 PM

Thanks for the replies.

Code:

local name = dropdownFrame:GetName()
returns the name of the frame.

Code:

local name = dropdownFrame.name;
returns the name of the target.

However your post still solved my problem so thank you. I got it to work with the following code:

Code:

local dropdownFrame = _G["UIDROPDOWNMENU_INIT_MENU"];
local name = dropdownFrame.name;

Not sure why getglobal didnt work anymore, I'm sure I'm still using it else where in my addon for other things...

Thanks again,

Felankor

Tuhljin 02-06-09 07:43 PM

Code:

local dropdownFrame = _G["UIDROPDOWNMENU_INIT_MENU"];
==
Code:

local dropdownFrame = UIDROPDOWNMENU_INIT_MENU;
They're the same thing. getglobal doesn't work because, as I said, UIDROPDOWNMENU_INIT_MENU points to the actual frame, not the frame's global name.

Cyn325 02-09-09 11:23 PM

getglobal doesn't work anymore because of changes Blizzard made with their coding. caused an error with a lot of addons.

Tuhljin 02-10-09 04:43 PM

Okay, believe whatever you want. Obviously I'm not going to be able to convince you of this, even though it's extremely simple for an addon author to check these things for themselves.


All times are GMT -6. The time now is 03:07 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI