Well going further I have several objects I create in the loop along with the button. I wanted to keep them together in a structure of some sort. For example:
Code:
local node = {}
for p=1,4,1 do
node[p].button = Chain( wm:CreateControl("button"..p, ss, CT_BUTTON) )
:SetDimensions(50,50)
:SetText("button"..p)
:SetAnchor(TOPLEFT, ss, TOPLEFT, 0,(p*50)-50)
:SetFont("ZoFontAlert")
.__END
end
function update()
node[1].button:SetText("newname")
end
Which would not work so I tried something like this but then I cant reference the button text anymore.
Code:
local node = {}
for p=1,4,1 do
thisNode = node[p]
thisNode.button = Chain( wm:CreateControl("button"..p, ss, CT_BUTTON) )
:SetDimensions(50,50)
:SetText("button"..p)
:SetAnchor(TOPLEFT, ss, TOPLEFT, 0,(p*50)-50)
:SetFont("ZoFontAlert")
.__END
end
function update()
thisNode = node[1]
thisNode.button:SetText("newname")
end