Thread Tools Display Modes
Prev Previous Post   Next Post Next
05/23/14, 10:29 AM   #1
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Post Index Nill and Square Brackets

I have two questions if anyone can help me out. Thanks!

First Question:
Can anyone tell me why one of these works and the other does not?
TargetHPBar[1] turns out nil for ZO_TargetUnitFramereticleover, but it works for ZO_PlayerAttributeHealth
Lua Code:
  1. HPBar =       {ZO_PlayerAttributeHealth,      true, false, DEFAULT_ALPHA,   69,   0, 300, DEFAULT_SCALE},
  2. TargetHPBar = {ZO_TargetUnitFramereticleover, true, false, DEFAULT_ALPHA,    0, 150, 300, DEFAULT_SCALE},

I'm trying to do this:
Lua Code:
  1. ConfigurableUI.BarSetup(TargetHPBar)
  2.  
  3. function ConfigurableUI.BarSetup(_BarTable)
  4.     _Control, _Unlocked, _Hidden, _Alpha, _Posx, _Posy, _Width, _Scale = unpack(_BarTable)
  5.     _Control:SetMovable(_Unlocked)
  6.        ...
  7. end

Second Question:
Looking at other addons I can't figure out what the difference is between some of the assignments I see like:
Lua Code:
  1. -- I see some like this...I get this one.
  2. DAMAGE_COLOR         = { 1, 1, 1, 1 }
  3. -- But I also see some with square brackets around them
  4. [DAMAGE_TYPE_NONE]      = { 1, 1, 1, 1 }
  5. -- Some also have single quotes in them
  6. ['ZO_ActionBar1'] = {1, myaddon.stuff}
  7. -- Some also have double quotes in them
  8. ["enabled"] = true,
Whats the difference in those ? Why do some have square brackets, some have ['...'] and some have ["..."]?

Thanks
  Reply With Quote
 

ESOUI » Developer Discussions » Lua/XML Help » Index Nill and Square Brackets


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off