From b86efbb9435f50346e3f4ae07c12e51e17325492 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Wed, 7 Apr 2021 18:07:04 +0100 Subject: [PATCH] Made requested changes --- modules/commands/search.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/commands/search.lua b/modules/commands/search.lua index 52143bdd..62d1ab33 100644 --- a/modules/commands/search.lua +++ b/modules/commands/search.lua @@ -54,11 +54,11 @@ local function sort_players(players, func) -- Loop over all provided players for index, player in ipairs(players) do local value = func(player) - -- Check if the item will make the top 10 elements + -- Check if the item will make the top 5 elements if value > threshold or index <= 5 then local inserted = false values[player] = value - -- Find where in the top 10 to insert the element + -- Find where in the top 5 to insert the element for next_index, next_player in ipairs(sorted) do if value > values[next_player] then table.insert(sorted, next_index, player) @@ -133,7 +133,7 @@ Commands.new_command('search-recent', 'Display players who hold an item sorted b display_players(player, top_players, item) end) ---- Return the index of the player, higher means they joined more recently +--- Return the the amount of an item a player has divided by their playtime local function combined_sort(data) return data.count/data.online_time end