Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- testlist={{"item1",2,3,2},{"item2",3,2,2},{"item3",3,2,1},{"item4",1,1,2},{"item5",1,1,1},{"item6",2,1,1},{"item7",2,1,2}}
- print(textutils.serialize(testlist))
- sleep(3)
- print("-----------------------")
- table.sort(testlist, function(a,b) return a[2]<b[2] end)
- table.sort(testlist, function(a,b)
- for i=2,4 do
- if a[i]<b[i] then return true end
- if a[i]>b[i] then return false end
- end
- end)
- for i=1,#testlist do
- print(testlist[i][1])
- end
- --print(textutils.serialize(testlist))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement