recursive function call with parameter

Bugs will be moved here once resolved.

Post » Sun Aug 24, 2014 7:54 am

Problem Description
parameters are on a function(global?) stack (not on the function instance stack)

Attach a Capx
see attachment

Description of Capx
recursive call of a function with parameter(0)+1

Steps to Reproduce Bug
  • Step 1: open the capx
  • Step 2: start the capx
  • Step 3: press the 'next >' butten more then 1 time

Observed Result
parameter(0) = 1

Expected Result
parameter(0) should count per recursive call +1

Affected Browsers
all browsers

Operating System and Service Pack
windows 7

Construct 2 Version ID
C2, r178
You do not have the required permissions to view the files attached to this post.
Image Image Image
B
42
S
22
G
15
Posts: 375
Reputation: 12,221

Post » Sun Aug 24, 2014 9:14 am

You can use it like that
You do not have the required permissions to view the files attached to this post.
B
21
S
8
G
6
Posts: 177
Reputation: 8,134

Post » Sun Aug 24, 2014 1:49 pm

will not work with more than one object/instance using the same recursive function
Image Image Image
B
42
S
22
G
15
Posts: 375
Reputation: 12,221

Post » Tue Aug 26, 2014 3:24 pm

Closing as not a bug. The 'Wait' action causes the event to wait until after the function call has completed, so there are no longer any parameters available. Requesting any parameter outside of a function call will return 0. You can prove function parameters are working per call stack by implementing a simple factorial function with no 'wait' actions.
Scirra Founder
B
395
S
232
G
88
Posts: 24,371
Reputation: 193,762

Post » Tue Aug 26, 2014 4:11 pm

Thank you for clearing this!
Image Image Image
B
42
S
22
G
15
Posts: 375
Reputation: 12,221


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 1 guest