Quantcast WoWInterface - View Single Post - Skinning default raid frames
View Single Post
03-29-15, 12:31 PM   #4
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,059
This is line 123; the error is saying that _G["CompactRaidFrame" .. i] doesn't exist, so it's the same as calling nil:CreateBeautyBorder(12).
Lua Code:
  1. for i = 1, 80 do -- Raid Frames, do we really have 80 of them? Don't remember
  2.     _G["CompactRaidFrame" .. i]:CreateBeautyBorder(12)
  3. end
You need to add a check that the frame you're trying to access has been created, and you may as well make a function for it since you call it so many times.

Something like this..
Lua Code:
  1. local function Borderize(frame) -- style our frame
  2.     if frame then
  3.         frame:CreateBeautyBorder(12)
  4.     end
  5. end
  6.  
  7. -- ...
  8.  
  9. for i = 1, 5 do -- Party Frames
  10.     Borderize(_G["CompactPartyFrameMember" .. i])
  11. end
  12.  
  13. for i = 1, 80 do -- Raid Frames
  14.     Borderize(_G["CompactRaidFrame" .. i])
  15. end
  16. -- etc.

You should probably also have checks preventing you from styling the same frame more than once (I have no idea what CreateBeautyBorder does), and you have globals like "b" and "f", but that should at least fix your error.
  Reply With Quote