-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: Inside functions wait until does not work #722
Comments
Just to give an idea, here's how complex it is now: at the top it makes this trigger:
Then down in the body where the wait statement actually existed, it turns that trigger on with:
So it sets the CPU's state to What's causing the problem is the fact that the trigger's scope is outside the scope of the function, so it's not allowed to see the functions' variables in its expression check. (it's probably falling back to a more global $t instead of the local one). I see no reason at all for this to be implemented on the back of the already beleaguered trigger system, with its upper limit on instructions allowed and so on, when you could just do all the logic right there inline in the code like so:
So it basically just spins in a loop forever checking the expression right there in the inline code, but in a way that only loops once per update rather than busy polling. So much cleaner. Doing this will also solve issue #688, as it is caused by accidentally triggering the "trigger" logic when it should have not done so (using a zero wait makes the system think it's a WAIT UNTIL when it isn't). |
actually I think I got the gt/lt 's backward in my above examples typed out manually, but you get the gist of it. |
Fixed when PR #726 got merged. |
To reproduce run the following script
The second wait finishes instantly.
The text was updated successfully, but these errors were encountered: