allow not sorting a crafting icon list
This commit is contained in:
1 parent
9b42676fad
commit
d0a2ec3d06
1 file changed
+3
-3
+3
-3
@@ -829,9 +829,10 @@ end
|
|||||||
-- Converts a given table into a string containing the crafting icons of the table
|
-- Converts a given table into a string containing the crafting icons of the table
|
||||||
-- Example input: {1,2,3,4,5,6,7,8}
|
-- Example input: {1,2,3,4,5,6,7,8}
|
||||||
-- Result: "{{Crafting8}}{{Crafting7}}{{Crafting6}}{{Crafting5}}{{Crafting4}}{{Crafting3}}{{Crafting2}}{{Crafting1}}"
|
-- Result: "{{Crafting8}}{{Crafting7}}{{Crafting6}}{{Crafting5}}{{Crafting4}}{{Crafting3}}{{Crafting2}}{{Crafting1}}"
|
||||||
function EID:tableToCraftingIconsFull(craftTable)
|
function EID:tableToCraftingIconsFull(craftTable, sortTable)
|
||||||
|
if (sortTable == nil) then sortTable = true end
|
||||||
local sortedList = {table.unpack(craftTable)}
|
local sortedList = {table.unpack(craftTable)}
|
||||||
table.sort(sortedList, function(a, b) return a > b end)
|
if (sortTable) then table.sort(sortedList, function(a, b) return a > b end) end
|
||||||
local iconString = ""
|
local iconString = ""
|
||||||
for _,nr in ipairs(sortedList) do
|
for _,nr in ipairs(sortedList) do
|
||||||
iconString = iconString.."{{Crafting"..nr.."}}"
|
iconString = iconString.."{{Crafting"..nr.."}}"
|
||||||
@@ -846,7 +847,6 @@ local emptyPickupTable = {}
|
|||||||
for i=1,29 do emptyPickupTable[i] = 0 end
|
for i=1,29 do emptyPickupTable[i] = 0 end
|
||||||
function EID:tableToCraftingIconsMerged(craftTable)
|
function EID:tableToCraftingIconsMerged(craftTable)
|
||||||
local sortedList = {table.unpack(craftTable)}
|
local sortedList = {table.unpack(craftTable)}
|
||||||
table.sort(sortedList, function(a, b) return a > b end)
|
|
||||||
local filteredList = {table.unpack(emptyPickupTable)}
|
local filteredList = {table.unpack(emptyPickupTable)}
|
||||||
for _,nr in ipairs(sortedList) do
|
for _,nr in ipairs(sortedList) do
|
||||||
filteredList[nr] = filteredList[nr] +1
|
filteredList[nr] = filteredList[nr] +1
|
||||||
|
|||||||
Reference in new issue
Block a user