Need help with []

BlitzMax Forums/BlitzMax Beginners Area/Need help with []

Chroma(Posted 2005) [#1]
What I'm having trouble with is taking a:
MyVar[100]


and integrating it with a type like so:
MyVar[100]

MyVar:Basic = New Basic

MyVar[0].x = 1000
MyVar[50].z = 25

Type Basic
     Field x#,y#,z#
End Type


That's what I'm trying to do. I think I'm close but just can't quite get it. I've done this in Blitz3D but it's not the same in BMax obviously. Any help is appreciated.

EDIT
Seems you have to go:
MyVar[0] = New Basic


I hate it when I post and then answer my own question a few mintues later. :(


Perturbatio(Posted 2005) [#2]
Global MyVar:Basic[100]

For Local a:Int = 0 To Len(MyVar)-1
	MyVar[a] = New Basic
Next

MyVar[0].x = 1000
MyVar[50].z = 25

Type Basic
     Field x#,y#,z#
End Type



Chroma(Posted 2005) [#3]
Bleh...neither of ours work Pert. 8(


Chroma(Posted 2005) [#4]
ahh...thanks for revising it


rdodson41(Posted 2005) [#5]
Create an array of new instances:
Type Basic
    Field x#, y#, z#
EndType

Global MyVar:Basic[100] = New Basic[100]

MyVar[0].x = 1000
MyVar[50].z = 25