Skip to content
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

Matching against patterns for inputs #18

Open
weakman54 opened this issue Jun 18, 2018 · 2 comments
Open

Matching against patterns for inputs #18

weakman54 opened this issue Jun 18, 2018 · 2 comments

Comments

@weakman54
Copy link

I would like to be able to match against patterns, atm, I have four combo inputs, and would like to check if any of them is pressed (to trigger the combo). right now this requires me to check each in turn, in one large or condition. being able to do something like

if input:pressed("combo%a*") then

would greatly help this.

I also have a use case where I just want to check against any button being pressed/released (I have some events that only trigger after a short amount of time of an input being held, which is tracked by a simple timer variable. I want to only increase this variable while any button is held, and reset each time a button is released).

@tesselode
Copy link
Owner

tesselode commented Jun 18, 2018

This seems like it would be pretty straightforward to implement without cluttering the API. However, by any chance, would variable arguments (ie input:pressed('controlA', 'controlB', 'controlC')) also work? It's not as powerful as pattern matching, but pattern matching strikes me as a bit wonky for this application.

@weakman54
Copy link
Author

sure, that would at least reduce repetition a bit. Though then the case to check against any key would be another special case, instead of just matching against ".*"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants