diff --git a/fs_trade_limit.lua b/fs_trade_limit.lua index e7aab12..4207ef4 100644 --- a/fs_trade_limit.lua +++ b/fs_trade_limit.lua @@ -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