I’m using code to sort the order of the Parts by Position;
The results that I’m looking for is:
Green1… Green2
Red1 … Red6
Yellow1 … Yellow4
Blue1 … Blue3
(or vice versa)
I’m using code to sort the order of the Parts by Position;
The results that I’m looking for is:
Green1… Green2
Red1 … Red6
Yellow1 … Yellow4
Blue1 … Blue3
(or vice versa)
I normally specify which one is larger in my sort functions. Try using statements like
return A.Name > B.Name
Isn’t that the same as what I’m doing with the if statements?
Well in the if statements you’re comparing their X and Z value of the position, but not the position in the table. You return true but you don’t assign a position in the table. At least thats the only reason I can think it wouldn’t work
table.sort doesn’t require a position but just a boolean
return 2 > 1 and 3 > 2 is the same as return true
Maybe it’s because it’s not being set to do anything if the statement isn’t true? The statement makes A ahead of B if it meets the requirements, but doesn’t do anything if it doesn’t. Maybe thats the case? I’m honestly not sure just picking at straws
Hey, @ancant64!
I really appreciate your effort to help, I’ve solved the challenge on my own.
table.sort alone isn’t suitable for the Task so I’ve written my own Sorting Algorithm.