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 / Error Message Regarding UDT's Confusing

Author
Message
Mr909
14
Years of Service
User Offline
Joined: 2nd Jun 2012
Location:
Posted: 17th Nov 2012 20:35
So, I'm trying to input a UDT into a function like so:



Notice that both "in"(from the function) and "pl_bank"(from the code) have the same defined type. Yet the compiler gives me an error reading: "Both user-defined type values must be the same at line 16" (trying to set them to the same thing).

Is this just not supposed to work? is there something I'm missing?
The Weeping Corpse
14
Years of Service
User Offline
Joined: 19th Sep 2011
Location: United Kingdom
Posted: 17th Nov 2012 22:18
I don't think functions can return UDTs

Mr909
14
Years of Service
User Offline
Joined: 2nd Jun 2012
Location:
Posted: 17th Nov 2012 22:21
Then why does the error message say that the UDT values must be the same? It seems to indicate this is not the case.
The Weeping Corpse
14
Years of Service
User Offline
Joined: 19th Sep 2011
Location: United Kingdom
Posted: 17th Nov 2012 22:48 Edited at: 17th Nov 2012 22:57
Well it would seem the error message is misleading. IMHO DB Pro needs serious improvements to UDTs.

Anyways, you can use a global variable to work around this issue tho I understand it's not a perfect solution and is somewhat of a fudge.



Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 17th Nov 2012 23:10 Edited at: 17th Nov 2012 23:12
I agree it's misleading.

Something like this might do what you want:



Edit Damn! Shouldn't watch TV when composing a reply. The Weeping Corpse beat me to it.
The Weeping Corpse
14
Years of Service
User Offline
Joined: 19th Sep 2011
Location: United Kingdom
Posted: 17th Nov 2012 23:20 Edited at: 17th Nov 2012 23:24
Quote: "
Edit Damn! Shouldn't watch TV when composing a reply. The Weeping Corpse beat me to it.
"




he he

Mr909
14
Years of Service
User Offline
Joined: 2nd Jun 2012
Location:
Posted: 17th Nov 2012 23:47
OOOOOOOOOOhhh... GLOBAL returns..... shiiiiinyyy.... O.O

I wouldn't have thought of that for months.

I'll consider that approach, although my mind is already halfway done with a pros/cons list of why it might be a bad idea to do so.

In the meanwhiles, I will append that to my prior condition regarding DBElite that it allows arrays in UDTs. It would be very useful to have functions return them.

Thanks The Weeping Corpse!
Thanks Green Gandalf!
The Weeping Corpse
14
Years of Service
User Offline
Joined: 19th Sep 2011
Location: United Kingdom
Posted: 18th Nov 2012 00:06




Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 18th Nov 2012 00:55
I think you missed some brackets.
Mr909
14
Years of Service
User Offline
Joined: 2nd Jun 2012
Location:
Posted: 20th Nov 2012 01:25
No, Weeping. I'm not sarcastic, just extremely effeminate for a guy and incredibly peppy. I'm sorry if I offended you. I for serious do think it's shiny.

However, you did miss some brackets.

It's more like this

Login to post a reply

Server time is: 2026-07-10 12:34:08
Your offset time is: 2026-07-10 12:34:08