Possibly something like this so you can store references to your created buttons into ButtonTable
Lua Code:
local ButtonTable = {
LogoutButton = { active=true },
ExitButton = { active=true },
FStackButton = { active=true },
ClearChatButton = { active=true },
ChatSpacerButton = { active=true },
ETraceButton = { active=true },
ETraceStartButton = { active=true },
ETraceStopButton = { active=true },
ChatLogButton = { active=true },
CombatLogButton = { active=true }
}
for k, v in pairs(ButtonTable) do
if active then
local f = CreateFrame("Button", "WhateverTheNameIs", UIParent, "UIPanelButtonTemplate")
v.button = f -- store the reference to the new button into ButtonTable
-- rest of the button creation
end
end
local function buttonFrameButtonLayout()
for k, v in pairs(ButtonTable) do
if v.active then
thisButton = v.button --retrieve the reference to the button from ButtonTable
thisButton:ClearAllPoints()
-- ...
end
end
end