Check: local var stack not big enough

Bugs will be moved here once resolved.

Post » Mon Nov 09, 2015 3:35 am

Message: aronduby can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Problem Description
Using a timer to edit local variable works once but then repeat calls fails with the "Check: local var stack not big enough" message in the console. Seems to work if I make the variables global instead of local.

Attach a Capx

Description of Capx
A sprite has a Timer behavior that decrements a local variable and updates it's display in a text box every second.

Steps to Reproduce Bug
  • Preview project

Observed Result
Runs properly once, but further calls show message in the console

Expected Result
Variable gets decremented and text gets updated

Affected Browsers
  • Chrome: (YES)
  • FireFox: (YES/NO)
  • Internet Explorer: (YES/NO)

Operating System and Service Pack
Windows 10

Construct 2 Version ID
Release 216 (64-bit)
Posts: 7
Reputation: 820

Post » Thu Nov 12, 2015 3:03 pm

I don't think this is a bug. Non-static local variables are reset to their initial value when they are "run" (i.e. imagine an "every tick" event in the same position resetting the variable). So first of all a local variable is not suitable for a countdown that needs to remember its old value. Secondly that message is just a debug note. I've removed it for the next build since it doesn't really matter. It's a bit unusual to access local variables from a trigger, because local variables only really "exist" for the normal run of evaluated events within their group - and triggers fire outside of that. So it's taking a "this variable doesn't exist" code path (which previously logged a debug message), and falling back to returning the initial value.

Making the variable static also works, since that stops it resetting every tick and makes its lifetime permanent.
Scirra Founder
Posts: 25,284
Reputation: 200,852

Post » Thu Nov 12, 2015 10:11 pm

Ah, I see. Thanks for the thorough explanation and the static fix. Still working on shifting my head from vanilla JS to this setup.

Thanks for the awesome program!
Posts: 7
Reputation: 820

Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 0 guests