View Single Post
03/18/19, 08:01 AM   #7
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,966
You do not need a "if Addon ~= nil" check as this is already handled via
Addon = Addon or {}

It basically does the nil check and it it is nil it will create a new table via {}.
You can use this for each table variable, or even other variables to do a nil check.
e.g.
local var1 = var2 or var3

You can even use some short forms like this
local booleanVar1 =(addon ~= nil and addon.booleanVar1) or false
  Reply With Quote