Beast-Masters-addons / feed-o-matic

WoW addon for feeding Hunter pets
9 stars 1 forks source link

Itemlevel sorting not working correctly #21

Closed Rhea-3 closed 11 months ago

Rhea-3 commented 11 months ago

Hi there :wave:, i noticed that the setting for prefering lower itemlevel food was not working as expected and looked up where the error does come from.

Seems that lua table.sort() not produces consistant results when comparing 2 equal values (in this case thats "priority" in FOM_NewFindFood), so the results from the previous sorting (delta) get flawed. Example fix attached.

See also http://www.lua.org/manual/5.1/manual.html#pdf-table.sort

The sort algorithm is not stable; that is, elements considered equal by the given order may have their relative positions changed by the sort.

Version: 9.6.1, Wotlk

FOM_FlatFoodList_fix.patch

:smiley_cat: