Honestly, I don't know why your line numbers are different than mine, maybe different versions. The code should look like this instead:
Code:
-- Initialise Each Bar
local bars = { "Player", "Target", "Focus", "Pet" };
local lastBar;
for _, token in ipairs(bars) do
local bar = AzCastBar.CreateMainBar("Frame",token,extraOptions);
bar.unit = token:lower();
local bg = CreateFrame("Frame", nil, bar)
bg:SetBackdrop({
bgFile = 'Interface\\ChatFrame\\ChatFrameBackground',
edgeFile = 'Interface\\ChatFrame\\ChatFrameBackground',
edgeSize = 1,
})
bg:SetBackdropColor(0, 0, 0, .4)
bg:SetBackdropBorderColor(0, 0, 0)
bg:SetFrameStrata("BACKGROUND")
bg:SetPoint("TOPLEFT", bar, -1, 1)
bg:SetPoint("BOTTOMRIGHT", bar, 1, -1)
-- Anchor
bar:ClearAllPoints();
if (lastBar) then
bar:SetPoint("TOP",lastBar,"BOTTOM",0,-8);
The reason why your previous placement wasn't working was because 'bar' had not been created yet, and so when the code was asked to run it, it had no clue what 'bar' meant. It then aborted the script, and then your addon wasn't working. Ta-daa!
EDIT: Also, I was using 'Interface\\AddOns\\TinyDPS\\Textures\\blank.tga' for my blank texture, instead of the universal one 'Interface\\ChatFrame\\ChatFrameBackground'. That sure didn't help the problem :P