View Single Post
04-15-14, 05:58 PM   #3
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
That said, there's really no reason to meddle with the Blizzard metatable. It's absolutely trivial to add methods to a frame, and you don't have to "replicate" anything; definte each method once, and just add a pointer to each frame as desired:

Code:
local function DoSomething(frame)
    -- do something with the frame
end

for i = 1, 100000 do
    _G["MyButton"..i].DoSomething = DoSomething
end
Obviously you don't (I hope) have 100000 buttons, but the principle is the same. It doesn't matter how many frames you attach the function to; only one copy of the function exists.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote