Quantcast ESOUI - View Single Post - Some LUA questions
View Single Post
03/18/19, 08:01 AM   #7
Baertram's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 2,534
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.
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