[Gambas-user] Arrays of Structs

Benoît Minisini gambas at ...1...
Tue Nov 29 05:11:31 CET 2016


Le 29/11/2016 à 04:40, Cam Era a écrit :
> I expect I'm trying to do something that's not possible with Gambas, but
> I'll ask this anyway.
>
> I'm trying to create an n x n array of a STRUCT which itself contains an
> array of type STRUCT.
>
> I have this declaration:
>
>     Public Struct MapObjec
>       xPos As Integer
>       yPos As Integer
>       ObjectType As Integer
>       isVisible As Boolean
>       ObjectPicture As Picture
>     End Struct
>
>     Public Struct MapRoom
>       MapObjects[50] As MapObject

--> This creates an inner array of 50 MapObject NULL references.

Try that: MapObjects[50] As Struct MapObject

By the way, I strongly suggest not to use Struct, but normal objects. 
Struct were mainly made to interface with C libraries.

Regards,

-- 
Benoît Minisini




More information about the User mailing list