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

Skip - prefix variable names when saving. (Ephemeral variables) #7495

Open
wants to merge 2 commits into
base: dev/feature
Choose a base branch
from

Conversation

Moderocky
Copy link
Member

Description

Variables starting with - will be skipped during saving.
There is no longer a warning about using -, since this is now the default behaviour.


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

@Moderocky Moderocky added the feature Pull request adding a new feature. label Jan 21, 2025
Copy link
Member

@UnderscoreTud UnderscoreTud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a way to add tests for this using JUnit?

}
Skript.warning("The character '" + token + "' is reserved at the start of variable names, " +
"and may be restricted in future versions");
if (first == '-')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the label for this loop still needed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not.

@ShaneBeee
Copy link
Contributor

ShaneBeee commented Jan 21, 2025

This PR confuses me for a couple reasons:

  1. If its now default to allow a hyphen in variables, why not remove it from the list of reserved tokens rather than checking for it and allowing bypass?
    (From the Variable class)
Screenshot 2025-01-21 at 12 33 10 AM
  1. In general it really confused me why SkriptLang decided this is an illegal token considering this has been the suggested method in the config since forever (Ive been using Skript for 7+ years and its always been there) and is still in the config as the suggested token for "memory variables".
    Maybe this should be made the default?
    (This has been suggested for YEARS, even tho a few (or one) team members were against it)
    From the default config (potentially added about 10 years ago, based on last commit):
Screenshot 2025-01-21 at 12 35 35 AM

@sovdeeth
Copy link
Member

sovdeeth commented Jan 24, 2025

  1. In general it really confused me why SkriptLang decided this is an illegal token considering this has been the suggested method in the config since forever (Ive been using Skript for 7+ years and its always been there) and is still in the config as the suggested token for "memory variables".
    Maybe this should be made the default?
    (This has been suggested for YEARS, even tho a few (or one) team members were against it)
    From the default config (potentially added about 10 years ago, based on last commit):

It was never an illegal token, it was reserved specifically in order to make it an official memory variable prefix, which is what this PR is doing.

Copy link
Member

@sovdeeth sovdeeth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, on second thought, shouldn't we catch this earlier in the process, like at saveVariableChange? Then it won't even be added to the save queue or serialized.

@ShaneBeee
Copy link
Contributor

It was never an illegal token, it was reserved specifically in order to make it an official memory variable prefix, which is what this PR is doing.

OHHHHH... ok I totally misread the PR then. The description was a bit vague and I didn't really know what it was doing. I see it now, thank you for the clarification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Pull request adding a new feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants