sort trade limit list by item name

This commit is contained in:
Sokomine 2022-09-05 07:08:55 +02:00
parent 0b26af1287
commit fe3b4c80df

View File

@ -176,11 +176,16 @@ yl_speak_up.get_fs_trade_limit = function(player, selected)
-- the table event selection returns a row index - we need to translate that to our table
local item_list = {}
local row = 2
local selected_row = 1
-- TODO: sort this list in some way? alphabeticly? by limit?
local descr_list = {}
for k,v in pairs( items ) do
table.insert(item_list, k)
end
-- avoid total chaos by sorting this list
table.sort(item_list)
local row = 2
local selected_row = 1
for i, k in ipairs( item_list ) do
local v = items[k]
if(selected and k == selected) then
selected_row = #item_list + 1
end