View Single Post
08-08-16, 01:56 AM   #2
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
Create a wrapper function that passes a variable, in this case, your intended frame. You can also combine lines 2 & 3.
Code:
local player_frame = MyAddOn:SkinFrame(PlayerFrame)
local target_frame = MyAddOn:SkinFrame(TargetFrame)

function MyAddOn:SkinFrame(frame)
    local bg = CreateFrame('Frame', nil, frame)
    bg:SetPoint('TOPLEFT', frame, "BOTTOMRIGHT", 0, -26)
    -- do the rest of your code here
    return frame -- returns your skinned frame
end
  Reply With Quote