View Single Post
05-03-08, 04:54 AM   #5
Slakah
A Molten Giant
 
Slakah's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 863
Originally Posted by Everglow View Post
Ok... here is what I came up with for my table

Code:
13  for i = 1,7 do
14      CTChatWindows[i] = {}
15      CTChatWindows[i]["tab"] = {}
16      CTChatWindows[i]["main"] = {}
17      CTChatWindows[i]["region"] = {}
18      setmetatable(CTChatWindows[i]["tab"], {__index = getglobal("ChatFrame"..i.."Tab")})
19      setmetatable(CTChatWindows[i]["main"], {__index = getglobal("ChatFrame"..i)})
20      setmetatable(CTChatWindows[i]["region"], {__index = getglobal("ChatFrame"..i.."TabDockRegion")})
21      CTChatWindows[i]["default"] = CTChatWindows[i]["tab"]:IsShown()
22      CTChatWindows[i]["showing"] = CTChatWindows[i]["tab"]:IsShown()
23  end
24  CTChatWindows["auto"] = true
I run into an error on line 21: Attempt to find 'this' in non-framescript object.

As I understand it, if I set a global frame as a prototype, any attempt at calling a function that doesn't exist in my table will look up and execute the function in the prototype. What am I missing here? What is the proper way to set this up?
I don't quite understand what your trying to achieve. If you want to hide all chat frames couldn't you just do:

Code:
local g = getfenv(0)

local function hideforever(frame)
    frame:SetScript("OnShow", frame.Hide)
    frame:Hide()
end

for i = 1, 7 do
    hideforever(g["ChatFrame"..i])
    hideforever(g["ChatFrame"..i.."Tab")
    hideforever(g["ChatFrame"..i.."TabDockRegion")
end
  Reply With Quote