[212]loopindex has wrong scope on return from function

Bugs will be moved here once resolved.

Post » Fri Aug 21, 2015 7:27 am

Problem Description
Moving from 206 to 212, I am finding my loops are broken. I ran through all of the releases up to 212, and the issue appears only in 212, presumably a side effect of the other loopindex fix. When iterating a double loop of X & Y, and calling a function which also iterates using the same variables, even though the loop iterates the correct number of times, using loopindex() returns the last values that the function had, from the previous call.

I suspect there may be other issues with this recent change, but this was the only case I could reproduce here.

Attach a Capx
www.blackhornettechnologies.com/Constru ... INDEX.capx

Description of Capx
Iterate in "x" and also "y" which calls a function that iterates the same names.

Steps to Reproduce Bug
    Run and look in CONSOLE for debug statements.

Observed Result
The outer loop works once, but after that, the outer loop only reports (via loopindex()) the last values set within the function's loop.

Expected Result
The scoping of the loop names/variables should revert back to the scope of the outer call.

Affected Browsers
  • N/A

Operating System and Service Pack
Win 8

Construct 2 Version ID
212
ImageImageImage
B
71
S
21
G
220
Posts: 3,648
Reputation: 123,725

Post » Fri Aug 21, 2015 12:54 pm

Gah. A supposedly trivial one-liner change that subtley broke things.

There was another issue with the Video plugin so I've released r212.2 which should have fixed this now.
Scirra Founder
B
387
S
230
G
87
Posts: 24,249
Reputation: 192,240

Post » Sat Aug 22, 2015 10:12 am

Thanx for this hotfix!
Image Image Image
B
42
S
22
G
15
Posts: 372
Reputation: 12,215


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 2 guests