View Single Post
08-09-13, 09:06 AM   #8
Billtopia
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 110
I know how to indirectly access the values in the metatable when the keys are known as for basic addon settings where I make the list but the addon is being designed so that the user may change the key, values on the fly so that they are able to add/remove/change things from the table... which also made me think that a metatable would not do what I want either, as if they delete a default command the metatable would restore it unless it was also removed from the metatable. I guess I should have stuck to using the metatable for static known to me settings lol
It seems easier in coding, and in memory usage to just construct the table on the addon's first run as the settings and what not are never truly known to me once the user messes with it.


-------------------------------------------------------------------------------
It is an addon that can take user supplied lua scripts and turn them into slash commands. The meta tables came into play in this case by me giving a few built in default commands such as "/eject #" "/helm" "/cloak" and what not...
The addon stores the slash commands and code in strings until the addonloaded event fires when it then converts them into the commands to make the slash commands.

I was not wanting to have to keep an index of what commands are in existance in the addon (or by the addon) and it seems a normal table better suits this than a table with a metatable... I guess I just got used to using metatables for settings and tried to put a square peg in a round hole by habit...
  Reply With Quote