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 / passing types into functions...

Author
Message
DrakeX
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location:
Posted: 10th Oct 2002 06:34
i wish! it seems the functionality is almost there but not quite. for example:

type abc
x,y,z
endtype

man as abc
man.x=10
man.y=20
man.z=30

a(man)
wait key
end

function a(blah as abc)
print blah.x
print blah.y
print blah.z
endfunction

it catches the "a(man)" and says "Unknown parameter at line 10."

strangely if you replace "a(man)" with "a(33)" or something it compiles and runs... so i wonder if they were planning to implement this useful feature!

i want to pass UDTs into functions!
i'm looking at yooooou!
Milamber
21
Years of Service
User Offline
Joined: 27th Sep 2002
Location: Australia
Posted: 11th Oct 2002 19:20
Okay, try putting a dot on the end of man and it compiles. This works because of the way both arrays and UDTs are treated. An array always has to have its brackets, a UDT always has to have its dot. It still doesn't work properly yet with just that (a bug?), but if you put in

then that spits out the right values. Try playing around a bit.

System Specs: AMD Athlon 1700+ XP, GA-7VRX motherboard, 128MB DDR RAM, GeForce2 MX400 64MB VRAM

Login to post a reply

Server time is: 2024-04-26 13:20:36
Your offset time is: 2024-04-26 13:20:36