Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Using an array within a type

Author
Message
FieldDoc
23
Years of Service
User Offline
Joined: 30th May 2003
Location: London, UK
Posted: 30th Oct 2003 17:46
Is this possible?

I would really like to use arrays within types but I can't get it to work. For instance, what's wrong with this?



The program won't compile. I was hoping to be able to do something like this you see:



Does DBPro not support this?

CattleRustler
Retired Moderator
22
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 30th Oct 2003 17:59
make the type with each property element you need then array the type

-RUST-
APEXnow
Retired Moderator
23
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 30th Oct 2003 18:55
FieldDoc, an alternative is to use a linked list, like this

Type utPlanetInfo
strName As String
nStart As Integer
nLength As Integer
EndType

Global Dim InOrbit(-1) As Integer
Global Dim autPlanetInfo(-1) As utPlanetInfo

For each object in the array autPlanetInfo, it can maintain the position of the starting point of the InOrbit array entries and the number of entries required. All you do is maintain the Global array InOrbit for all objects that are added to autPlanetInfo.

At the moment, DarkBASIC Professional does not support arrays in user defined types, but you can achieve the same requirement by using the above method, or any other method that suits the task at hand.... Thats how I've done it anyway.

APEX!


Login to post a reply

Server time is: 2026-07-26 13:02:10
Your offset time is: 2026-07-26 13:02:10