View Single Post
10-20-15, 07:54 AM   #2
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
Building tables programmatically isn't going to save you anything, IMO. You can do the same thing you were doing with the if checks, but in a more terse manner:

Code:
        ADVANCED_INTERFACE_GLOBAL_CONSTANTS = ADVANCED_INTERFACE_GLOBAL_CONSTANTS or {}
        ADVANCED_INTERFACE_GLOBAL_CONSTANTS.STAMPS = ADVANCED_INTERFACE_GLOBAL_CONSTANTS.STAMPS or {}
        ADVANCED_INTERFACE_GLOBAL_CONSTANTS.STAMPS.ADVANCED_USER_INTERFACE = ADVANCED_INTERFACE_GLOBAL_CONSTANTS.STAMPS.ADVANCED_USER_INTERFACE or {}
I omitted the last one because checking if a table is nil then setting it to nil if so makes no sense to me.

EDIT: I meant "isn't going to save you anything in this case" - I've built config tables programmatically in some of my AddOns, because otherwise I'd have a bunch of copy-paste code with slightly different labels.
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.

Last edited by Torhal : 10-20-15 at 08:32 AM.
  Reply With Quote