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

Helper for running code with copied local variables #7255

Merged
merged 2 commits into from
Dec 15, 2024

Conversation

sovdeeth
Copy link
Member

Description

Helper method to cut down on possible bugs when running an event with copied local variables.

Previous:

Variables.setLocalVariables(B, Variables.copyLocalVariables(A));
MY CODE HERE
Variables.setLocalVariables(A, Variables.copyLocalVariables(B));
Variables.removeLocals(B);

New:

Variables.withLocalVariables(A, B, () -> {
    MY CODE HERE
});

Target Minecraft Versions: any
Requirements: none
Related Issues: none

@sovdeeth sovdeeth added the enhancement Feature request, an issue about something that could be improved, or a PR improving something. label Dec 12, 2024
@cheeezburga cheeezburga added the feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version. label Dec 12, 2024
@sovdeeth sovdeeth merged commit 1aef9b0 into SkriptLang:dev/feature Dec 15, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request, an issue about something that could be improved, or a PR improving something. feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants