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 / Function Parameters? (User defined/Array)

Author
Message
Frapl
22
Years of Service
User Offline
Joined: 9th Feb 2003
Location: Germany
Posted: 10th Feb 2003 02:39
First of all: Is there no way to search through this forum???

Second: How do I make a function with user defined data types and/or arrays?

This is not working (compiler error):


I get errors if I try to give an array to a function, too. How do I declare a function to be able to give it a complete array as parameter?

I am using the 30 days trial. Any ideas?
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 10th Feb 2003 04:17
the arrays dont have to be hande into the function, they are global and can be accessed and changed without having to go into the function via the paramters.

Frapl
22
Years of Service
User Offline
Joined: 9th Feb 2003
Location: Germany
Posted: 10th Feb 2003 13:47
OK, but the code sample above isn't working at all. I tried to make this function because the following command results in a compiler error, too.

Compiler Error:


If I use the XYZValue datatype directly it works, but not if it is used within another userdefined dataype.

This works:


TheCyborg
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Denmark
Posted: 10th Feb 2003 14:16
Thats odd. Must be a bug.

TheCyborg Development.
http://TheCyborg.Amok.dk
The Ultimate Source To DarkBASIC Programming.
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 10th Feb 2003 17:52
I dont think u can declare the type parameter declaration with a type and hope to have the 3 parameters somehow magically work


u could do this

TYPE Player
x# AS Float
y# AS Float
z# AS Float
size AS Integer
points AS BYTE
ENDTYPE

Frapl
22
Years of Service
User Offline
Joined: 9th Feb 2003
Location: Germany
Posted: 10th Feb 2003 18:16
Mmmh, OK. But I hoped DBPro is capable to make some more structured source code. I normally code in C++ and other languages like this (object oriented) so I miss some features of this languages very much...

Is there really no way to use a userdefined datatype in another userdefined datatype??? I can not believe this!
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 12th Feb 2003 03:42
email [email protected] for a better response to your question, at the momo i dont think it works but if u nudge him politely he may add it

Frapl
22
Years of Service
User Offline
Joined: 9th Feb 2003
Location: Germany
Posted: 12th Feb 2003 11:53
OK, Thx! I try a little bit further. Maybe I find some more things which can be made better.
Jaidex
22
Years of Service
User Offline
Joined: 28th Jan 2003
Location:
Posted: 13th Feb 2003 22:31
To search the forums, see my earlier post at:

http://www.darkbasicpro.com/apollo/view.php?t=5874&b=1

Login to post a reply

Server time is: 2025-05-17 23:56:23
Your offset time is: 2025-05-17 23:56:23