-
-
Notifications
You must be signed in to change notification settings - Fork 382
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
Add SecFilter, refactor Variable and Variables slightly to accomodate. #6912
Add SecFilter, refactor Variable and Variables slightly to accomodate. #6912
Conversation
Wouldn't it be smart to also allow a lambda-like structure where one can return a boolean?
Not sure if Skript's current section API facilitates this feature, but it allows for more flexibility and is more intuitive in my opinion. Either way, I like both options actually since your proposition is a really clean way to filter expressions without the cluttering '[]' syntax that is used currently. |
Sections have access to a return api iirc in 2.9+ so this should be possible |
I considered this, but I thought it could get messy, and at that point there's no benefit to having a filter section over just doing
|
I have a suggestion question for this,
Example
I know for |
You can already use |
Ahhh ok, I was unaware of the |
while (keys.hasNext()) { | ||
key = keys.next(); | ||
if (key != null) { | ||
next = Variable.convertIfOldPlayer(subName + key, local, event, Variables.getVariable(subName + key, event, local)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unfortunate... we should aim to add an api for variable conversion (or find a way to move this) (not in this pr of course)
Co-authored-by: Patrick Miller <apickledwalrus@gmail.com>
Description
Adds a filter section to allow filtering on many conditions at once, while maintaining indices and adding significant performance optimization when only removing a few elements of a large list.
Also support
any
andall
, like multiline ifs.I would like feedback on the abuses of the Variable api I have committed, as I don't really think the code is that great. I couldn't think of any better approaches, however.
Target Minecraft Versions: any
Requirements: none
Related Issues: #6866