View Single Post
11-11-12, 03:19 PM   #13
Aanson
A Flamescale Wyrmkin
Join Date: Aug 2009
Posts: 124
Understood, thanks alot as always. It was very beneficial to have it broken down in that way.

I always knew it was a bit backwards.

What I didn't realize though was that it is less efficient than other methods (ie just referencing addonTable direct).

I was never worried about unpack() because the table keys were just 1 and 2, but I'll not be using it anymore. From what you've said, I don't want to be needlessly calling a function every time I reference the tables.
Lua Code:
  1. local addonName, addonTable = ...
  2.  
  3. local F = {};
  4. local V = {};
  5.  
  6. addonTable[1] = F;
  7. addonTable[2] = V;
  8.  
  9. EarthernUI = addonTable;

My intention with the final line is to have a global reference to addonTable. That way, when working on modules, I can easily reference to the table by using something like ...

Lua Code:
  1. local F = EarthernUI[1];
  2. local V = EarthernUI[2];
  3.  
  4. local c = V.Checks;
  5. local f = V.Frames;
  6. local m = V.Media;
  7. local v = V.IntVars;

... at the start of each module.

Is it okay to do it in this way?
__________________
__________________
  Reply With Quote