View Single Post
06-13-10, 09:33 PM   #16
yssaril
A Warpwood Thunder Caller
 
yssaril's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2007
Posts: 96
Originally Posted by Chimaine View Post
By the way, you dont need to create a local for frames you create with CreateFrame if these frames have a name. The name will be used to create a global named like the frame.
Code:
CreateFrame("Frame", "MyFrame")
MyFrame:Show()
Looking at your code, this could save insane amounts of upvalues...
then you are using global variables and have to make sure that you give each frame a very unique name.

This code would definitely work:
Code:
GrimUIPartyFunc = {}
 
-- Pedestal Frame 
    GrimUIPartyFunc.Party1PedestalFrame = CreateFrame('Frame', "Party1PedestalFrame", GUI_Party1Frame)
        Party1PedestalFrame.texture = Party1PedestalFrame:CreateTexture()
But you would be accessing the Frame by its Name "Party1PedestalFrame" which would be a global reference.
The following removes the global reference and makes everything local to your code with only the GrimUIPartyFunc being upvalued
Code:
local GrimUIPartyFunc = {}
 
-- Pedestal Frame 
    GrimUIPartyFunc.Party1PedestalFrame = CreateFrame('Frame', nil, GUI_Party1Frame) --use nil as name then we don;t create that global
        GrimUIPartyFunc.Party1PedestalFrame.texture = GrimUIPartyFunc.Party1PedestalFrame:CreateTexture()
-- access the frame via our trusty GrimUIPartyFunc table
  Reply With Quote