1. Hi all out there,

    my skills in lua programming are very basic so, who wonders, i'va reached a dead end. hope someone can haelp me out.

    situation: sreating suttons for - open bags - oamagmeter - ohat etc.

    so i wrote a Template for this:

    -- BUTTONTEMPLATE ---------------------------------------------------------------

     function MyAddonButtonTemplate()
    
     local f = CreateFrame("BUTTON", "f", UIParent)
          f:SetHeight(25)
          f:SetWidth(80)
          f:SetFrameStrata("MEDIUM")
          f:SetFrameLevel(1)
          f:SetPoint("CENTER", UIParent, "CENTER", 0 ,0)
    
     local s = f:CreateFontString("MyText", "f")
         s:SetFont("Interface\\Addons\\zInterface\\media\\HOOGE.TTF", 14, "OUTLINE")
         s:SetPoint("CENTER", 0, 0)
         s:SetTextColor(1,1,1,1)
         s:SetText("TEST")
    
     local t = f:CreateTexture()
                 t:SetParent(f)
                 t:SetAllPoints(f)
                 t:SetTexture("Interface\\Addons\\zInterface\\media\\BUTTON.tga")
    
                     f:SetScript("OnEnter", function(self) s:SetTextColor(c.r,c.g,c.b) end)
                     f:SetScript("OnLeave", function(self) s:SetTextColor(1,1,1,1) end)
       return f
     end
    

    now when i create my buttons (who wonders) all have the same "Test" text.

    -- BAGS BUTTON -----------------------------------------------------------------

    local BagButton = MyAddonButtonTemplate()
    BagButton:ClearAllPoints()
    BagButton:SetPoint("RIGHT", zMONSTERMENU, "RIGHT", -BagPosX, PosY)
    
        BagButton:SetText("Bags")
    
            BagButton:SetScript("OnClick", function(self) ToggleBackpack() end)
    

    so what to do that i can change the text for every button?

    thx for help Vinnie

  2. Store the created font string in the button, like f.text = f:CreateFontString(...) then you can alter it with f.text:SetText("foo").