Quantcast ChatTypeInfo curiosity - WoWInterface
Thread Tools Display Modes
12-27-17, 09:20 PM   #1
Kanegasi
A Frostmaul Preserver
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 251
ChatTypeInfo curiosity

I have discovered an "obscured table".

If you access ChatTypeInfo using a key, such as /dump ChatTypeInfo.SYSTEM, the result is the information for that chat event as expected, such as RGB values. However, if you try to dump the whole table, it's as empty table.

How is this possible?
  Reply With Quote
12-28-17, 07:02 AM   #2
Vrul
A Frostmaul Preserver
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 266
By using setmetatable on ChatTypeInfo and setting the metatable's __index to a table or function. In this case it is a table.

It is the same reason you can iterate over pairs(CreateFrame("Frame")) and only see a key-value pair of [0] and userdata but still be able to access all of its methods such as Hide and Show.
  Reply With Quote
12-28-17, 03:13 PM   #3
Kanegasi
A Frostmaul Preserver
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 251
Ah, I see. Despite my ongoing knowledge of Lua, I still don't have a grasp on the meta stuff.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » ChatTypeInfo curiosity

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off