Hello everyone. I am having problems with table.sort(). I have table with frames that NOT nil and this table not sorted. I use these lines to sort this table
local function comp(Frame1 : Frame, Frame2 : Frame) return Frame1.LayoutOrder < Frame2.LayoutOrder end
local Frames = Menu:GetChildren() -- Not nil
local SortedFrames = table.sort(Frames, comp) -- is nil
My bad, just read documentation and realised that table.sort() returns nothing.
fixed code:
local function comp(Frame1 : Frame, Frame2 : Frame) return Frame1.LayoutOrder < Frame2.LayoutOrder end
local Frames = Menu:GetChildren() -- Not nil
table.sort(Frames, comp) -- is Frames var