-
-
Notifications
You must be signed in to change notification settings - Fork 341
Description
Is there an existing issue for this?
- I have searched the existing open and closed issues.
Description
Sorting in drop down menus fails to sort item links in lexicographical order. This can cause frustration because there's nothing the aura developer can do to fix this, since it's baked into the custom options code.
Why this occurs:
"\124cffffffff\124Hitem:18641::::::::60:::::\124h[Dense Dynamite]\124h\124r"
The above is a standard item link for [Dense Dynamite]. Sorting this raw string yields interference from color escape codes, followed by item ids.
Easy solution
I'm fairly sure the bug takes place in the fixMetaOrders of the CommonOptions.lua.
table.sort(groupOrders[index]) is called on the raw options.
Instead, the following can be performed.
Map the existing elements to a new list with the following mapper function:
local function mapper(str)
local p = "^.*Hitem:%d+:%d*:%d*:%d*:%d*:%d*:%d*:%d*:%d*:%d*:%d*:%d*:%d*:.*%[([^%]]+)%].*$"
local m = str:match(p)
return m or str
endNote: You can write that regex in a thousand different ways. I just wrote a simple example. Hitem followed by 13 mandatory : etc. Chances are 99% likely it's an item link.
Once you map the fields, use table.sort's optional parameter to use this table for comparisons.
WeakAuras Version
WeakAuras 5.20.4
World of Warcraft Flavor
Classic Era
World of Warcraft Region
US/NA
Tested with only WeakAuras
I got this issue with only WeakAuras enabled
Lua Error
N/A
Reproduction Steps
- Any aura -> Custom Options -> Option Group -> Array
- Sort: enabled
- Entry Name Source: (your key here)
- Drag items into the array field, press enter for each.
- Notice that items are not in lexicographic order.
Last Good Version
No response
Screenshots
Export String
N/A
Bisector Report
N/A