Skip to content

WeakAuras Custom Options invalid sorting on item links. #6057

@KevinTyrrell

Description

@KevinTyrrell

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
end

Note: 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

  1. Any aura -> Custom Options -> Option Group -> Array
  2. Sort: enabled
  3. Entry Name Source: (your key here)
  4. Drag items into the array field, press enter for each.
  5. Notice that items are not in lexicographic order.

Last Good Version

No response

Screenshots

Image

Export String

N/A

Bisector Report

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions