ark1320 Posted July 5, 2023 Report Posted July 5, 2023 When using event.button(joy, btn,"button_fcn") if the button_fcn function is running due to a button press when a second button press occurs, is the currently running button_fcn immediately killed and a new instance of button_fcn initiated? Thanks, Al
ark1320 Posted July 5, 2023 Author Report Posted July 5, 2023 4 hours ago, John Dowson said: No, the function will complete, OK, then if a second button push happens while the function in response to the first button push is running, is that second button push "missed" or will the button function be called again as soon as it completes due to the first button push? UPDATE: Looks like the second button press is not missed and the button function will be called again. Thanks, Al
John Dowson Posted July 5, 2023 Report Posted July 5, 2023 Not 100% sure, but it will probably be missed, but this depends when the event flag on the button press is cleared - either when the function is called (in which case the 2nd button press will be registered) or when the function is finished (in which case it will be missed). I think its the latter, but should be easy to write a simple test lua to clarify if needed. Anyway, the function should really finish before the second button press, and you can also use button repeats. John
ark1320 Posted July 6, 2023 Author Report Posted July 6, 2023 6 hours ago, John Dowson said: Anyway, the function should really finish before the second button press, and you can also use button repeats. I was thinking about the triple function button script that detects a second button press. Al
John Dowson Posted July 6, 2023 Report Posted July 6, 2023 9 hours ago, ark1320 said: I was thinking about the triple function button script that detects a second button press. Do you have any issues with that script?
ark1320 Posted July 6, 2023 Author Report Posted July 6, 2023 5 hours ago, John Dowson said: Do you have any issues with that script? No, was just thinking the script does respond to a double button press so the second press is not missed. I guess the issue is does the buttonpress function due to the first press complete before the second press happens. If not, then it would seem the button presses are "registered" as you called it. Al
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now