[Gambas-user] gb3: using array of structures with dimensions unknown until runtime

tobi tobiasboege01 at ...1601...
Wed Jul 4 22:06:50 CEST 2012


On Wed, 04 Jul 2012, Kevin Fishburne wrote:
> On 07/04/2012 05:42 AM, Emil Lenngren wrote:
> > When you are declaring the array by writing
> > A[3] As Single
> > you declare an inline array, i.e. NOT a reference to an array.
> > So you cannot write
> > ThatStruct.A = AnArray.
> > Instead you have to copy the contents from AnArray into A.
> >
> 
> I'm not sure how to go about copying the contents, as even this gives me 
> a null object error:
> 
> Public Struct Surface_Normal
>    N As Single[]
> End Struct
> 
> Dim NormalsA As New Surface_Normal[TileGrid.Size + 2, TileGrid.Size + 2]
> NormalsA[0, 0].N[0] = 0
> 
> I spent about an hour last night trying every combination of 
> declarations and assignments I could think of, all with various errors. 
> Initially I wanted a structure so I could have a 2D array with each 
> element having an A and B vector, but now I'm searching for ANY way to 
> get it done. How can I declare a 2D array whose element is a 1D array of 
> three singles? Despite reading the docs again and again I'm not clear on 
> the syntax.
> 
> -- 
> Kevin Fishburne
> Eight Virtues
> www: http://sales.eightvirtues.com
> e-mail: sales at ...1887...
> phone: (770) 853-6271
> 
> 
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user

You could have a one-dimensional Variant[] which contains other Variant[] (and so on n times) to
get an n-dimensional matrix...




More information about the User mailing list