Need help with dynamic lists

Galacticat42

Drifting through space, lost
Joined
May 8, 2008
Messages
1,234
Location
CA, USA
Okay, for my ATOM mod, my first real roadblock here is trying to get a list on a screen to update dynamically. I've been looking at the different screens already in the game and have come up with this.
Code:
function setupPlanetTerritories(Planets, PlanetNum)
	g_Planets = {Planets};
	local bFoundHome = true;
	Controls.StarName:SetText("Sol");
	Controls.PlanetStack:DestroyAllChildren();
	for i=1,PlanetNum do
		Name = Planets[PlanetNum][2];
		local instance = {};
		print(Name);
		ContextPtr:BuildInstanceForControl( "PlanetEntry", instance, Controls.PlanetStack );
		[B]instance.PlanetName:SetText(Name)[/B]
	end
        Controls.PlanetStack:CalculateSize();
        Controls.PlanetStack:ReprocessAnchoring();
	Controls.PlanetScroll:CalculateInternalSize();
end
LuaEvents.setupColonyTerritories.Add(setupPlanetTerritories)

And the XML that it refers to is
Code:
			<ScrollPanel Offset="0,28" Size="210,442" ID="PlanetScroll" Vertical="1" >
				<ScrollBar  Offset="8,0"  Style="VertSlider"      Anchor="R,C"   AnchorSide="o,i"    Length="434" />
				<UpButton   Offset="8,2"  Style="ScrollBarUp"     Anchor="R,T"   AnchorSide="o,i"    />
				<DownButton Offset="8,2"  Style="ScrollBarDown"   Anchor="R,B"   AnchorSide="o,i"    />
				
				<Stack Anchor="C,T" StackGrowth="Bottom" ID="SystemStack" >
					<Box Size="175,45" Color="Beige,0" Anchor="C,T" >
						<Label Offset="0,0" Font="TwCenMT20" Anchor="C,C" String="Star Name" ID="StarName" />
					</Box>
					<Stack Anchor="L,C" ID="PlanetStack" />
				</Stack>
			</ScrollPanel>

		</Box>

		<!--=======================================================================================================================-->
		<!--=======================================================================================================================-->
		<Instance Name="PlanetEntry" >
			<Button  Size="210,24" ID="Planet" >
				[B]<Label Offset="20,0" Font="TwCenMT16" Anchor="L,C" String="Planet Name" ID="PlanetName"  />[/B]
				<ShowOnMouseOver>
					<AlphaAnim Anchor="L,C" Size="210,27" Pause="0" Cycle="Bounce" Speed="1" AlphaStart="2" AlphaEnd="1"  >
						<Grid   Size="210,27" Offset="0,2" Padding="0,0" Style="Grid9FrameTurnsHL" />
					</AlphaAnim>
				</ShowOnMouseOver>
				<!-- Selected State  -->
				<Grid Anchor="C,C" Offset="0,1" Size="210,26"  Style="Grid9FrameTurns" Hidden="1" ID="PlanetEntryHighlight" />
			</Button>
		</Instance>

The problem I'm having is that tuner is complaining that instance.PlanetName is a nil value when it clearly has a string for text.
 
Back
Top Bottom