View Single Post
06-08-19, 08:52 PM   #3
JDoubleU00
A Firelord
 
JDoubleU00's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 463
Originally Posted by Fizzlemizz View Post
Code:
lt[j-1][2]
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:
  1. local peorder = {
  2.    {"JWXPBar","JWXPBarFrame",0,5},
  3.    {"JWRepBar","JWRepBarFrame",0,5},
  4.    {"BFAInvasionTimer","BFAInvasionTimer",0,25},
  5.    {"Skada","SkadaBarWindowSkada",0,25},
  6. }
  7.  
  8. local lt = {}
  9.  
  10. for key, value in pairs(peorder) do
  11.    if IsAddOnLoaded(peorder[key][1]) and _G[peorder[key][2]]:IsVisible() then
  12.       table.insert(lt,peorder[key])
  13.    end
  14. end
  15.  
  16. for j, k in pairs(lt) do
  17.    print(lt[j][1]..","..lt[j][2]..","..lt[j][3]..","..lt[j][4])
  18. 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.

Click image for larger version

Name:	peo.jpg
Views:	94
Size:	41.3 KB
ID:	9239
__________________
Author of JWExpBar and JWRepBar.
  Reply With Quote