-
-
Notifications
You must be signed in to change notification settings - Fork 374
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
Fix some syntaxes overwriting variable list indices and add new helper method for changing expressions. #7120
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sovdeeth
added
bug
An issue that needs to be fixed. Alternatively, a PR fixing an issue.
enhancement
Feature request, an issue about something that could be improved, or a PR improving something.
labels
Sep 30, 2024
sovdeeth
requested review from
Moderocky,
Pikachu920,
Efnilite and
UnderscoreTud
September 30, 2024 18:04
Efnilite
requested changes
Sep 30, 2024
src/test/skript/tests/regressions/pull-7120-changes overwriting indices.sk
Outdated
Show resolved
Hide resolved
src/test/skript/tests/regressions/pull-7120-changes overwriting indices.sk
Outdated
Show resolved
Hide resolved
Efnilite
approved these changes
Sep 30, 2024
cheeezburga
approved these changes
Oct 21, 2024
Moderocky
approved these changes
Oct 26, 2024
UnderscoreTud
approved these changes
Nov 6, 2024
sovdeeth
added
the
patch-ready
A PR/issue that has been approved and is ready to be merged/closed for the next patch version.
label
Nov 6, 2024
APickledWalrus
approved these changes
Nov 21, 2024
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.
Great work! It is nice to see this problem fixed.
Co-authored-by: Patrick Miller <apickledwalrus@gmail.com>
Burbulinis
pushed a commit
to Burbulinis/Skript
that referenced
this pull request
Dec 3, 2024
…r method for changing expressions. (SkriptLang#7120) * changeInPlace, fix indices being overwritten, regr tests * can't count * requested changes * Apply suggestions from code review Co-authored-by: Patrick Miller <apickledwalrus@gmail.com> --------- Co-authored-by: Patrick Miller <apickledwalrus@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
An issue that needs to be fixed. Alternatively, a PR fixing an issue.
enhancement
Feature request, an issue about something that could be improved, or a PR improving something.
patch-ready
A PR/issue that has been approved and is ready to be merged/closed for the next patch version.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
A few expressions/effects currently clear the indices of variable lists used in them, since they use ChangeMode#SET indiscriminately. This PR adds a new default method on Expression, changeInPlace(Event, Function), which applies a Function to each value of the Expression, then calls change() with SET using the new values.
For Variables, this method is overwritten to use the variable's iterator, meaning that calling
expr.changeInPlace()
is a safe way to change all expressions while maintaining indices for variable lists.Behavior change is limited to not overwriting variable indices anymore, but also it does not remove elements of the wrong type from variable lists:
I believe this to be bug fixing rather than breaking, but let me know if you disagree.
or if you disagree with the implementation!
Target Minecraft Versions: any
Requirements: none
Related Issues: none