Originally Posted by Fizzlemizz
The lt table only has one entry per key so lt[j][2] and lt[j-1][2] is always nil (visually the same as using UIParent as the anchor for all frames). Just use _G[lt[j]] or _G[lt[j-1]]
Code:
_G[lt[j][2]]:SetPoint("BOTTOMLEFT",_G[lt[j-1][2]],"TOPLEFT",lt[3],lt[4])
lt[3], lt[4] are the third and fourth key in the lt table, frame name strings or nil depending. Did you mean
Code:
pestartpoint[4], pestartpoint[5] -- -10, 30
|
The lt table has four items per key. It will look just like peorder but only has the active addons listed. I tested that with this code:
Lua Code:
local peorder = {
{"JWXPBar","JWXPBarFrame",0,5},
{"JWRepBar","JWRepBarFrame",0,5},
{"BFAInvasionTimer","BFAInvasionTimer",0,25},
{"Skada","SkadaBarWindowSkada",0,25},
}
local lt = {}
for key, value in pairs(peorder) do
if IsAddOnLoaded(peorder[key][1]) and _G[peorder[key][2]]:IsVisible() then
table.insert(lt,peorder[key])
end
end
for j, k in pairs(lt) do
print(lt[j][1]..","..lt[j][2]..","..lt[j][3]..","..lt[j][4])
end
The second piece of each key is the frame name I use for anchoring (except for the first time where I use unpack(pestartpoint). The third and fourth pieces are the x and y offset. I went back to a single line for setpoint:
_G[lt[j][2]]:SetPoint("BOTTOM",_G[lt[j-1][2]],"TOP",lt[j][3],lt[j][4])
The code works without errors, but does not always place the addons where I think they should be. Sorry, my screen grabs are crappy looking. In this image, JWXPBars is not enabled.