ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   Proper sorting by level (https://www.esoui.com/forums/showthread.php?t=8114)

Marazota 10/22/18 01:42 AM

Proper sorting by level
 
guys there is an addon Crafting Material Level Display
where you can sort by level

its possible to sort by level without this issue when lvl 1 items dont come first?
right now sorting order is:
2
3
4
5
6
7
8
10
1
11

Author of addon said its base game issue right?
Quote:

Could not fix the sorting and the game will always reposition items with the same level each time you do something in the inventory list, so one would need to sort it by level + name, which isn't working within this addon as it breaks the vanilla game name sorting then.

Baertram 10/22/18 05:18 AM

First I'm not the author. I'm just maintaining this addon to keep it alive.
And secondly I said "Could not fix the sorting" which means I was not able to do this.

The stuff I mentioned about the vanilla game behaviour relates to the repositioning of items in your inventory list, if you change the sort etc. The items won't be sorted by name, but by level.
As the sort function of the game recognizes the levels as a string (and not as a number) it somehow does not sort them like numbers
1
10
11
but just as string, and everytime different after you change something (like described above):
10
1
11
or
1
10
11
or
11
10
1
or
11
1
10

Maybe one can fix this by using tonumber() in the sort function.
Maybe one can add a "tiebraker = name" to the level sort header so the items will be sorted by level + name to keep the order.

But I'm currently not able to do and test this. So if anyone wants to try, go ahead.

Draxinusom 10/22/18 08:37 AM

The expected "lexical" sort order is generally called "Alphanumerical sorting" or "Natural sorting". Standard c-type simple sort algorithms are usually for the sake of brevity and complexity not able to do that. Here's a few test implementations for lua:
http://notebook.kulchenko.com/algori...-humans-in-lua


All times are GMT -6. The time now is 12:13 PM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2014 - 2019 MMOUI