View Single Post
06-23-21, 12:23 AM   #8
Walkerbo
A Cobalt Mageweaver
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 233
Hi Fizzlemizz

Thanks for that, using _G[] does get rid of the errors yet it does not give me the desired button layout.

With every button selected I get just 2 visible, (btns 6 and 10), and neither is anchored to the frame.
I have commented out the original buttons setpoints to test.

Here is my table of variables and the updated function;
Lua Code:
  1. local VariableList = {
  2.     currentParentAnchorPoint = "BOTTOM",
  3.     currentAnchorButton = NewbDevBoxButtonFrameReloadButton,
  4.     currentChildAnchorPoint = "TOP",
  5.     currentSideGap = 0,
  6.     currentYGap = NumberList.actionButtonYGap,
  7.     currentButtonCount = 2,
  8.     topAnchorButton = NewbDevBoxInterfaceFrameReloadButton
  9. }
  10.  
  11. local function buttonFrameButtonLayout()
  12.     for k, v in pairs(NewbDevBoxDisplayButtonTable) do
  13.         if v then
  14.  
  15.             thisButton = _G["NewbDevBoxButtonFrame" .. k]
  16.  
  17.             thisButton:ClearAllPoints()
  18.             thisButton:SetPoint(
  19.                 VariableList.currentParentAnchorPoint,
  20.                 VariableList.currentAnchorButton,
  21.                 VariableList.currentChildAnchorPoint,
  22.                 VariableList.currentSideGap,
  23.                 VariableList.currentYGap
  24.             )
  25.  
  26.             if VariableList.currentButtonCount == 3 then
  27.                 VariableList.currentParentAnchorPoint = "LEFT"
  28.                 VariableList.currentAnchorButton = VariableList.topAnchorButton
  29.                 VariableList.currentChildAnchorPoint = "RIGHT"
  30.                 VariableList.currentSideGap = NumberList.actionButtonSideGap
  31.                 VariableList.currentYGap = 0
  32.                 VariableList.currentButtonCount = 1
  33.  
  34.             elseif VariableList.currentButtonCount == 1 then
  35.                 VariableList.currentParentAnchorPoint = "BOTTOM"
  36.                 VariableList.currentAnchorButton = thisButton
  37.                 VariableList.currentChildAnchorPoint = "TOP"
  38.                 VariableList.currentSideGap = 0
  39.                 VariableList.currentYGap = NumberList.actionButtonYGap
  40.                 VariableList.currentButtonCount = VariableList.currentButtonCount + 1
  41.                 VariableList.topAnchorButton = thisButton
  42.  
  43.             else
  44.                 VariableList.currentParentAnchorPoint = "BOTTOM"
  45.                 VariableList.currentAnchorButton = thisButton
  46.                 VariableList.currentChildAnchorPoint = "TOP"
  47.                 VariableList.currentSideGap = 0
  48.                 VariableList.currentYGap = NumberList.actionButtonYGap
  49.                 VariableList.currentButtonCount = VariableList.currentButtonCount + 1
  50.             end
  51.  
  52.         end
  53.     end
  54. end

I have uploaded both my lua and toc files to pasbin
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz
  Reply With Quote