How to sort 1s after 2s

Basically when you have say 1000 items each named a number so 1,2,3,10,1000 it sorts 1,10,100,1000,2,20,200,2000 i want to have it sort 1,2,3,4,5,6,7

Looks like you are sorting them in a string-based fashion. Maybe you should try sorting them in a number-based method instead?

i’m talking about the explorer
Screenshot 2024-03-26 145343

Ah, so this is the complication of the explorer. The instances are always sorting it as if they were strings and always left-to-right. Therefore you have to substitute those numbers by adding zeroes to the left in order to keep them in check.

However, you should re-evaluate that by sorting the parts in different folders instead… It could save you some headaches away from reorganizing.

I also heard there was a tool for sorting these things. Maybe find one that can do it since I know it has been proven to be able to manipulate the Explorer visually. Why don’t you try it out?

The way the explorer sorts objects is quite inconvinient. It basically sorts objects like so:


Therefore if there are 3 objects name 1,2 and 10. So it will sort them as:


But, if you add 0’s before the numbers in a way that all numbers have a character limit of 3 then it would sort them as:


This can be done by using the “%0.2i” string pattern as so:

local number = 20
local numberLength = 5
local formattedNumber = string.format("%0."..numberLength.."i",number)
print(formattedNumber) -- would print 00020

Hope this helped.