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.

Newcomers DBPro Corner / Are you sure you cannot use UDTs in arrays?

Author
Message
Darkhog
11
Years of Service
User Offline
Joined: 25th Nov 2012
Location: Mushroom Kingdom
Posted: 2nd Dec 2012 20:17
Because I've just did



and all fields of all array items are accessible and works. Someone mentioned you cannot do them and since I'm notorious impossible things maker, I did this.

I'm using U77 RC7 and Matrix1Utils if it does matter.
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 2nd Dec 2012 21:16
Having an array of a UDT data type is fine (as most of us know). What we can't do is have an array within a UDT.

E.g
Type
Dim x(5) as integer
y as float
z as string
End type

You might be able to get around it with a pointer but I haven't tried.

Darkhog
11
Years of Service
User Offline
Joined: 25th Nov 2012
Location: Mushroom Kingdom
Posted: 2nd Dec 2012 23:43
Ah, so I've misunderstood. BTW. Does DarkBasic even has pointers?
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 3rd Dec 2012 00:01
Quote: "Does DarkBasic even has pointers?"

Yep. It's been a while since I used DBP and looked at the documentation (check Principles) but I think you do something like this:

*p = make memory(number_of_bytes)

I can't even remember if that's the right command but it's something to the effect of that.

Login to post a reply

Server time is: 2024-11-23 18:17:45
Your offset time is: 2024-11-23 18:17:45