How do I set multiple return values ?

Get help using Construct 2

Post » Mon Mar 30, 2015 4:04 pm

Hi,
I am interested, is it possible to set and get multiple return values, or it is restricted to be just one?

Code: Select all
Function->Set return value->Function.Param(0)+Function.Param(1)
Call "calculate" (10,20)

returns 30

This function calculates Sum of parameters, but is it possible to calculate several values and return it?

thanks
You do not have the required permissions to view the files attached to this post.
B
10
S
3
Posts: 25
Reputation: 709

Post » Mon Mar 30, 2015 6:02 pm

yes, using another if (sub event) inside "on function"
"If you want to move a mountain tomorrow, you should start by lifting stones today."
B
64
S
14
G
3
Posts: 292
Reputation: 7,188

Post » Mon Mar 30, 2015 6:10 pm

thanks puntodamar,
actually found a workaround, that imitates multiple returns, but how to do this with sub event ?
https://www.dropbox.com/s/4ohjbalogjsk2 ... 8.png?dl=0
Last edited by LabSimulator on Fri May 01, 2015 10:34 am, edited 6 times in total.
B
10
S
3
Posts: 25
Reputation: 709

Post » Mon Mar 30, 2015 6:53 pm

You can only return a single value from a function. Your workaround should be OK.
ImageImageImage
B
71
S
22
G
258
Posts: 3,791
Reputation: 143,198


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 5 guests