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.

Author
Message
richardneail
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 15th Sep 2003 17:26
Hi,

Just messing around with types and arrays and was wondering if anyone can tell me how to make an array that contains a type global so that I can access in in a function e.g.

type Mytype
var1
var2
var3
endtype

dim myarray(4) as Mytype

function Myfunction(no)
myarray(no).Mytype.var1 = 1
endfunction

I have tried using global dim on the array but get the following error.

#100038: Could not find field 'Mytype' in type `Mytype` at line ....


Rich

You might never win but if you give in will you ever know ??????
Codger
23
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 15th Sep 2003 17:28
I believe you will find that arrays are global by default

System
PIII 650 MZ H.P. Pavillion
394 Mem GeForce 4 400MX
indi
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 15th Sep 2003 17:48
like this bro



http://www.lunarpixel.com
It's already tomorrow in Australia
richardneail
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 15th Sep 2003 17:55
Hi,

Thanks for the help I sorted the problem though, when you access the type variables you dont need the type name.

you put

myarray(no).var1 = 1

Not

myarray(no).Mytype.var1 = 1

as I had been putting.

Rich

You might never win but if you give in will you ever know ??????
David T
Retired Moderator
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 15th Sep 2003 22:07
Hello again rich it's been a while!

c:/dos
c:/dos run
run dos run
richardneail
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 16th Sep 2003 11:50
Hi David,

Yer it's been a long time actually !!! lol

Finally decided to have a look at DBP have some very interesting ideas that I want to try out.

Drop me a IM some time or email me, email is on the web site.

Rich

You might never win but if you give in will you ever know ??????

Login to post a reply

Server time is: 2026-07-26 05:03:23
Your offset time is: 2026-07-26 05:03:23