Thread Tools Display Modes
10-26-23, 06:14 PM   #1
dragonflyy
An Aku'mai Servant
 
dragonflyy's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 32
Getting a frame through global

I have been away from WoW for 2 years, just started playing again and wanted to update an old addon I had made. However, I am running into a problem. I need to get each of the party frames, but the method I've used before is not working.

If I manually grab the frames:
Code:
PartyFrame.MemberFrame1
then it returns a table and I can hide/show that frame no problem.

Once I try to add it to a variable, it comes up nil. The way I've done this in the past was:
Code:
local frame = _G["PartyFrame.MemberFrame1"]
This returns nil, using just _G["PartyFrame"] does give me the PartyFrame, but I can't get the MemberFrames individually. The reason I used this method was a for loop:
Code:
for i=1, 4 do
  frame = _G["PartyFrame.MemberFrame" .. i]
end
This used to work (2 years ago) but now it's nil. Did the _G change, or am I just missing something obvious here?

Tried searching around on the internet but can't seem to find a change.
  Reply With Quote
10-26-23, 09:21 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
The .MemberFrame means it is a key of the PartyFrame ie. PartyFrame["MemberFrame1"] or _G["PartyFrame"]["MemberFrame1"]

But the (retail) member frames are part of a pool these days so,
Lua Code:
  1. for memberFrame in PartyFrame.PartyMemberFramePool:EnumerateActive() do
  2.     print(memberFrame.unit)
  3. end
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 10-26-23 at 09:26 PM.
  Reply With Quote
10-26-23, 10:10 PM   #3
dragonflyy
An Aku'mai Servant
 
dragonflyy's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 32
Thank you!
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Getting a frame through global


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off