In your last example:
Code:
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:
Code:
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.
Edit:
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:
http://www.wowace.com/paste/6263/
Example and options in the comment header at the top of the file.