local MAX_TABLES = 8 do local entry = CreateFrame("Button", "$parentEntry1", Poker_TableBrowserTableList, "Poker_TableBrowserEntry") entry:SetID(1) entry:SetPoint("TOPLEFT", 4, -28) for i = 2, MAX_TABLES do local entry = CreateFrame("Button", "$parentEntry"..i, Poker_TableBrowserTableList, "Poker_TableBrowserEntry") entry:SetID(i) entry:SetPoint("TOP", "$parentEntry"..(i-1), "BOTTOM") end end Poker_TableBrowser = {} Poker_TableBrowser.Tables = {} function Poker_TableBrowser.Update() for i = 1, MAX_TABLES do local entry = Poker_TableBrowser.Tables[i] local frame = getglobal("Poker_TableBrowserTableListEntry"..i) if entry then frame:Show() getglobal(frame:GetName().."Name"):SetText(entry[1]) getglobal(frame:GetName().."Host"):SetText(entry[2]) getglobal(frame:GetName().."Players"):SetText(entry[3].."/"..entry[4]) getglobal(frame:GetName().."Blinds"):SetText(entry[5].."-"..entry[6]) if entry.isSelected then getglobal(frame:GetName().."BG"):Show() else getglobal(frame:GetName().."BG"):Hide() end else frame:Hide() end end end for i = 1, MAX_TABLES do table.insert(Poker_TableBrowser.Tables, { "Test Table "..i, "Host "..(MAX_TABLES - i), i % 3 + 1, -- just dummy values 10, i * 10, i * 20 }) end Poker_TableBrowser.Update()