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

Sort loadouts dropdown based on name + number #7759

Closed

Conversation

deathbeam
Copy link
Contributor

@deathbeam deathbeam commented Jul 21, 2024

Currently the loadout order is kind of a mess so sort it by name and number if present so the order is at least consistent.

Link to a build that showcases this PR:

https://pobb.in/u/thedeathbeam/pf-poison-scourge-arrow

Before screenshot:

image

After screenshot:

image

@Paliak Paliak added the enhancement New feature, calculation, or mod label Jul 21, 2024
@Wires77
Copy link
Member

Wires77 commented Jul 21, 2024

Oh no: 600d1cd

Yours might be more robust though

Copy link
Member

@Wires77 Wires77 left a comment

Choose a reason for hiding this comment

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

Your sort function is better, but I might merge in some of the other changes I made. One tweak on yours though

Comment on lines +977 to +978
local aText, aNum = a:match("^(.+) {%d+}$"), tonumber(a:match("{(%d+)}"))
local bText, bNum = b:match("^(.+) {%d+}$"), tonumber(b:match("{(%d+)}"))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
local aText, aNum = a:match("^(.+) {%d+}$"), tonumber(a:match("{(%d+)}"))
local bText, bNum = b:match("^(.+) {%d+}$"), tonumber(b:match("{(%d+)}"))
local aText, aNum = a:match("^(.+) {%w+}$"), tonumber(a:match("{(%d+)}"))
local bText, bNum = b:match("^(.+) {%w+}$"), tonumber(b:match("{(%d+)}"))

The identifier doesn't have to be a number and I think we still want to sort by name if it's not

@deathbeam deathbeam closed this Jul 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature, calculation, or mod
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants