View previous topic :: View next topic |
Author |
Message |
Bagne ALL YOUR NUDIBRANCH ARE BELONG TO GASTROPODA

Joined: 19 Feb 2003 Posts: 518 Location: Halifax
|
Posted: Sat Apr 17, 2010 6:02 am Post subject: return |
|
|
Can functions only return 1 value?
I'd like to return 3.
Do I just have to wait until arrays? _________________ Working on rain and cloud formation |
|
Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Sat Apr 17, 2010 10:23 am Post subject: |
|
|
Yes, functions can only return 1 value.
There won't be an easy way to return 3 values until arays are implemented.
There are some harder ways to fake it.
One is to use global variables for the other two return values.
Another is to return an NPC reference or a Slice handle, with the return values packed in the "extra" data.
Neither of those is particularly easy to use, but they might be good enough for now? |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Sun Apr 18, 2010 12:23 am Post subject: |
|
|
I'm wondering whether we should support unpacking multiple return values. The new language features on that page are only suggestions, and for the most part have not been discussed. Some of them are probably too radical. _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
Newbie_Power

Joined: 04 Sep 2006 Posts: 1762
|
Posted: Sun Apr 18, 2010 1:41 am Post subject: |
|
|
I've used arguments as an improvised way to gain more values out of a script before. _________________
TheGiz> Am I the only one who likes to imagine that Elijah Wood's character in Back to the Future 2, the kid at the Wild Gunman machine in the Cafe 80's, is some future descendant of the AVGN? |
|
Back to top |
|
 |
|