#table.sort not sorting?

1 messages · Page 1 of 1 (latest)

delicate pawn
#

its not sorting in order help

#
table.sort(oSelectionFrame2.Frame.MainText:GetChildren(), function(a, b)
    return tonumber(a.Name) < tonumber(b.Name)
end)

for _, v in oSelectionFrame2.Frame.MainText:GetChildren() do
    print(v.Name)
end
alpine pulsar
#

Instance:GetChildren generates an array of the instance's children each time it's called

#

The array has no affect on the order of the children

#
local children = --[[Path.To.Parent]]:GetChildren()

table.sort(children, function(childA, childB)
    return childA.Name < childB.Name
end)

for _, child in children do
    print(child)
end
delicate pawn
#

thats so stupid

patent shoal
alpine pulsar
alpine pulsar
#

You'll come to understand why it works this way soon

#

It's not about why it doesn't work the way you wanted, but why it shouldn't

patent shoal
alpine pulsar
#

I started working on real projects

delicate pawn