Studio Listing // list items by taking numbering into account

disclaimer: I don’t know if this is the correct subforum
9432e3c7d90db5779f268dad02660abcf6c95152.png

Currently, the explorer lists your items like this:
• Part1
• Part10
• Part2
• Part3
• Part4
• Part5
• Part6
• Part7
• Part8
• Part9

While it should be listing it like this:
• Part1
• Part2
• Part3
• Part4
• Part5
• Part6
• Part7
• Part8
• Part9
• Part10

This often causes issues when you want to use certain models in a certain order and use naming to automate it (for easily updating).

This will mess things up if you use “for current=1,#models do” as it’ll randomly place #10 between #1 and #2.

I get this can be easily worked around, but it would still be a help, and would make much more sense if it took numbering into account.

7 Likes

Isn’t the order in the Explorer alphabetically, while the order of :GetChildren() is undefined? (but it seems to be always in the order the children got added) Using a numeric for loop directly on GetChildren is meant to have no static order, you’re just iterating, not iterating in a specific order.

Yes but the behavior does result in iterating from “top to bottom”, in a sense.

If you do this:

for i=1,10 do
	Instance.new("Part",workspace).Name = "Part"..i
end
for k,v in pairs(workspace:GetChildren()) do
	print(v)
end

I think it would print them in order, while the explorer shows it in the “Part1, Part10, Part2, …” fashion.

Ohh, it does! I figured it printed them in explorer’s order. That’s really helpful to know, thank you! Saved me a bunch of time.

If you’re looking for a personal fix, you can pad your numbers with 0s. 01-09 will show up before 10-99. 001-099 will show up before 100-999, etc.

for i=1,30 do
	Instance.new("Part",workspace).Name = "Part"..("%.2i"):format(i)
end

will create parts with this naming scheme for 2 digits. See Format String for more information about how that works if you don’t already know.

1 Like

Yeah, padding is what I do.

Also, interestingly, Windows always had this problem too. I don’t think they changed it until Windows 7 or something. What you’re experiencing is a default alpha-numeric sort. Since “1” comes before “2”, it also means that “10” gets sorted before “2”, since it’s not taking the trailing number into account.

I was overjoyed when windows finally changed this to perform as expected.

Unfortunately it still sorts my games “Mass Effect 2” “Mass Effect 3” “Mass Effect” :(

2 Likes

I thought the lack of a character (or \0) would come before a space (\32 or something?) though?

Nope

Yes please!!
They should make it an option in Studio settings.

But lately, I’ve just been padding my numbers.

This would still be a great change to make to studio. If there’s items with numbers at the end of the name, they should be sorted numerically