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 / i want to pass types to functions

Author
Message
DrakeX
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location:
Posted: 13th Oct 2002 07:26
i'd like to!

type mine
x
y
endtype

bob as mine
modtype(bob,1,2)
end

function modtype(t as mine,x,y)
t.x=x
t.y=y
endfunction

wouldn't it be nice?

in fact that function declaration above compiles just fine; however DBP flags the "modtype(bob,1,2)" as it doesn't like me to not put the name of the type without accessing one of its variables.
i'm looking at yooooou!
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 13th Oct 2002 08:09
ya know the type and globals aren't in the manual - they maybe simple copies of the types from DarkEdit...
if this is the case then they are globals, don't need to declare them in the function.

so just setting it up as such... like
function modtype(x,y)
mine.x = x
mine.y = y
endfunction

as you only really need to input the nessary values you need input, and not the entire value structure.
that make any sense?

Holy jumping mother of god NOOOO!!!...
The One Ring
21
Years of Service
User Offline
Joined: 15th Sep 2002
Location: United States
Posted: 13th Oct 2002 18:31
DrakeX, I had a discussion a week (or so) ago about passing UDTs as parameters, and having functions return UDTs... This apparently does not work. Raven Vageta hit it pretty close. DBPro apparently only allows the use of UDTs globally.

AMD Athlon 900 256MB DDR
ATI Radeon All-In-Wonder 7500, ATI XPert 128
Sound Blaster Audigy Gamer

Login to post a reply

Server time is: 2024-04-24 11:36:27
Your offset time is: 2024-04-24 11:36:27