I’m currently trying to sort 3D arrays (frames in a GUI with different names) so that it’s in alphabetical order.
Here is an image of what I want to do.
Any help would be greatly appreciated! <3
I’m currently trying to sort 3D arrays (frames in a GUI with different names) so that it’s in alphabetical order.
Here is an image of what I want to do.
Any help would be greatly appreciated! <3
You can compare strings in Lua and it’s sorted based on ASCII order. print("a" > "b")
will be false, for example.
table.sort(t, function(a, b)
return a.Name > b.Name
end)
Thank you, but it didn’t really work. It DID sort the table, but it didn’t change the position.
(a should be ontop)
you gotta change the individual .LayoutOrder
property of each UI element to match the order
Oh could you please provide me with an example? Sorry, I don’t really know much about UI
literally right here
https://developer.roblox.com/en-us/api-reference/property/GuiObject/LayoutOrder
it’s like ZIndex, you just order it based on a number
Tysm! Thank you for helping. <3
https://developer.roblox.com/en-us/api-reference/enum/SortOrder
UILayout instances allow you to sort by name anyway.
Should consider changing the topic to something like “How to sort frames in a GUI by name?” so the info is relevant to someone if this shows up in a search. Sorting 3D arrays with table.sort is a very different problem.