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

Fix variable names with long numbers #4737

Conversation

TPGamesNL
Copy link
Member

@TPGamesNL TPGamesNL commented Apr 21, 2022

Description

Changes the variable name comparator to not rely on long parsing, instead comparing digits manually.

Output from the test script in the first linked issue:
image
Other test code:

command /test2:
	trigger:
		loop 300 times:
			set {_i} to -1 + (loop-value) / 100
			set {_l::%{_i}%} to "a"
		loop {_l::*}:
			message loop-index

Output: https://pastebin.com/htAPMQXg


Target Minecraft Versions: any
Requirements: none
Related Issues: #4729, #3929 (latter non-fixing)

… and is therefore not restricted to ~19 digits
@TPGamesNL TPGamesNL added bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. variables Related to variables and/or storing them. labels Apr 21, 2022
Copy link
Member

@APickledWalrus APickledWalrus left a comment

Choose a reason for hiding this comment

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

As long as this has been tested, it should be fine. A test should be added though if possible.

I also have to ask, why are variable names compared to this extent? Is there a reason to know more than whether or not the names are the same?

@TPGamesNL
Copy link
Member Author

I also have to ask, why are variable names compared to this extent? Is there a reason to know more than whether or not the names are the same?

If we want to loop a list variable with number indices, we want to make sure it loops from 1-n, not an arbitrary order. Same for non-number indices, we want them to loop in alphabetical order, but also if we have sth like

  • {test::abc-1}
  • {test::abc-2}
  • {test::abc-30}
    this should loop in the right order of numbers too

@TPGamesNL TPGamesNL requested a review from APickledWalrus July 17, 2022 08:41
@TheLimeGlass TheLimeGlass merged commit 145bc59 into SkriptLang:master Oct 20, 2022
TheLimeGlass pushed a commit that referenced this pull request Oct 20, 2022
@TPGamesNL TPGamesNL deleted the fix/variable-name-comparator-long-numbers branch October 21, 2022 08:54
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. variables Related to variables and/or storing them.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants