I'm making a script to auto-align Chat frames based on their scroll button positions.
Code:
for i=1,7 do
_G["ChatFrame"..i]:SetJustifyH(_G["ChatFrame"..i].buttonSide)
_G["ChatFrame"..i]:SetScript("OnUpdate", function() _G["ChatFrame"..i]:SetJustifyH(_G["ChatFrame"..i].buttonSide) end)
end
However I get an error with frame 2-7. ChatFrame1 works fine, but apparently ChatFrame2.buttonSide is nil.
Using DevTools,
/dump ChatFrame2.buttonSide showed "right".
/run ChatFrame1:AddMessage(ChatFrame2.buttonSide) showed "right" as well. But whenever this script runs I always get an error saying
Usage: ChatFrame2:SetJustifyH("justify").
Halp please?