WoWInterface - View Single Post - oUF_AuraBars
Thread: oUF_AuraBars
View Single Post
09-18-12, 12:30 AM   #11
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
In your last example:
local buff = buffs[i] 
bar.aura = aura --BuffBars.bars[i].aura
would set "bar.aura" to nil, because "aura" isn't defined. I think you meant "bar.aura = buff" there.

In your current file, line 305:
local bar = bars[i] --unecessary?  se line 267 above
No, because line 267 is not in scope here. Local only exist inside the "if/for/do/function ... end" block where they are defined with the "local something" declaration. The entire file counts as one big "do ... end" block for the purpose of scoping, but each block inside the file gets its own scope, and they nest like those Russian dolls. Each scope can only "see" variables declared in itself, or in a higher scope that contains itself. Line 267 and line 305 are in parallel scopes of equal depth; neither can "see" any variables defined inside the other.


Alright, I just ended up rewriting the whole thing. Tested (as far as the BuffBars element with 2 buffs on a level 12 warlock) and working:


Example and options in the comment header at the top of the file.
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!

Last edited by Phanx : 09-18-12 at 04:26 AM.
  Reply With Quote