crafting icon sort goes in ascending order

This commit is contained in:
Buurazu authored and GitHub committed 2021-11-19 21:08:35 -05:00
1 parent 93341be9f2
commit c103f5a9af
1 file changed
+3 -3
+3 -3
View File
@@ -829,11 +829,11 @@ end
-- Converts a given table into a string containing the crafting icons of the table
-- Example input: {1,2,3,4,5,6,7,8}
-- Result: "{{Crafting8}}{{Crafting7}}{{Crafting6}}{{Crafting5}}{{Crafting4}}{{Crafting3}}{{Crafting2}}{{Crafting1}}"
-- Result: "{{Crafting1}}{{Crafting2}}{{Crafting3}}{{Crafting4}}{{Crafting5}}{{Crafting6}}{{Crafting7}}{{Crafting8}}"
function EID:tableToCraftingIconsFull(craftTable, sortTable)
if (sortTable == nil) then sortTable = true end
local sortedList = {table.unpack(craftTable)}
if (sortTable) then table.sort(sortedList, function(a, b) return a > b end) end
if (sortTable) then table.sort(sortedList, function(a, b) return a < b end) end
local iconString = ""
for _,nr in ipairs(sortedList) do
iconString = iconString.."{{Crafting"..nr.."}}"
@@ -843,7 +843,7 @@ end
-- Converts a given table into a string containing the crafting icons of the table, which are also grouped to reduce render lag
-- Example input: {1,1,1,2,2,3,3,3}
-- Result: "3{{Crafting3}}2{{Crafting2}}3{{Crafting1}}"
-- Result: "3{{Crafting1}}2{{Crafting2}}3{{Crafting3}}"
local emptyPickupTable = {}
for i=1,29 do emptyPickupTable[i] = 0 end
function EID:tableToCraftingIconsMerged(craftTable)