Thread: KGPanels script
View Single Post
11-10-14, 12:41 AM   #27
suicidalkatt
A Rage Talon Dragon Guard
 
suicidalkatt's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 331
Originally Posted by Choonstertwo View Post
You're initialising the oEvents table as an array of strings (i.e. strings are values), but you're using it as if it were a hashset (i.e. strings are keys).

You should be initialising it like this:
lua Code:
  1. local oEvents = { -- These are events that we can check for
  2.     GOSSIP_SHOW = true,
  3.     BANKFRAME_OPENED = true,
  4.     GUILDBANKFRAME_OPENED = true
  5. }
It's simply checking if the event is in the table. It should still return valid.

Alternatively you could do this as well:

Lua Code:
  1. local oEvents = {
  2.     "GOSSIP_SHOW",
  3.     "BANKFRAME_OPENED",
  4.     "GUILDBANKFRAME_OPENED"
  5. }
  6.  
  7. if tContains(oEvents,event) then
  8.     ChatFrame1:Hide()
  9.     ChatFrame3:Hide()
  10.     ChatFrame1ButtonFrame:Hide()
  11.     ChatFrame3ButtonFrame:Hide()
  12.     ChatFrameMenuButton:Hide()
  13.     GeneralDockManager:Hide()
  14.     FriendsMicroButton:Hide()
  15. else
  16.     ChatFrame1:Show()
  17.     ChatFrame3:Show()
  18.     ChatFrame1ButtonFrame:Show()
  19.     ChatFrame3ButtonFrame:Show()
  20.     ChatFrameMenuButton:Show()
  21.     GeneralDockManager:Show()
  22.     FriendsMicroButton:Show()
  23. end

Last edited by suicidalkatt : 11-10-14 at 12:43 AM. Reason: formatting
  Reply With Quote