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

Kevin Fishburne kevinfishburne at ...1887...
Wed Jul 4 22:03:17 CEST 2012


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





More information about the User mailing list