crafting icon sort goes in ascending order
This commit is contained in:
1 parent
93341be9f2
commit
c103f5a9af
1 file changed
+3
-3
+3
-3
@@ -829,11 +829,11 @@ 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: "{{Crafting1}}{{Crafting2}}{{Crafting3}}{{Crafting4}}{{Crafting5}}{{Crafting6}}{{Crafting7}}{{Crafting8}}"
|
||||||
function EID:tableToCraftingIconsFull(craftTable, sortTable)
|
function EID:tableToCraftingIconsFull(craftTable, sortTable)
|
||||||
if (sortTable == nil) then sortTable = true end
|
if (sortTable == nil) then sortTable = true end
|
||||||
local sortedList = {table.unpack(craftTable)}
|
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 = ""
|
local iconString = ""
|
||||||
for _,nr in ipairs(sortedList) do
|
for _,nr in ipairs(sortedList) do
|
||||||
iconString = iconString.."{{Crafting"..nr.."}}"
|
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
|
-- 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}
|
-- 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 = {}
|
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)
|
||||||
|
|||||||
Reference in new issue
Block a user