You are not logged in. You can browse in the PowerBASIC Community, but you must click Login (top right) before you can post. If this is your first visit, check out the FAQ or Sign Up.
Arrays within a UDT is only available in PB/DOS 3.5. The following code compiles and runs fine:
Code:
Type MyType
MyVar1 as integer
MyVar2(900) as single
End Type
DIM MyArray(1 to 10) as MyType
MyArray(3).MyVar1 = x
However, because an array inside a UDT is not exactly the same as a conventional array, you cannot use them with the graphic "get" statement, exactly as you have found. The "workaround" is to use a conventional arraym and move the data across to the array within the UDT.
1) Can i DIM an array as a TYPE?
Type MyType
MyVar1 as integer
MyVar2(900) as single
End Type
DIM MyArray(1 to 10) as MyType
well when i do the above i get an error on a statement like this
MyArray(3).MyVar1 = x
2) I want to use GET & PUT for animation on a game i'm making
But when i try using an Array w/in a type it says it's a Syntax Error
Type MyType
MyPic(900)
etc...
End Type
DIM MyPictureType as MyType
Get (0,0)-(30,30), MyPictureType.MyPic <-- however this works fine using a normal array (not within a Type)
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Leave a comment: