Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 11th, 2012  |  syntax: Lua  |  size: 0.48 KB  |  hits: 24  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.  
  2. ns.spellbars = setmetatable({}, {
  3.         local spellbars = {}
  4.         __newindex=function(t,i)
  5.                 local spellbar = CreateFrame("Frame")
  6.                
  7.                 spellbar.spellID = i
  8.                
  9.                 function spellbar:Test(test)
  10.                         print("Spellbar Test: ", self.spellID)         
  11.                 end
  12.                 print("Spellbar Created: ", i)
  13.                 table.insert(spellbars, spellbar) -- inserts it into the spellbars table
  14.                 return spellbar
  15.         end,
  16.         __index=function(t,i)
  17.                 for v in ipairs(spellbars) do
  18.                         if v.spellID = i then return v end
  19.                 end
  20.         end
  21.  
  22. });