How to sort this lua table?
问题 I have next structure self.modules = { ["Announcements"] = { priority = 0, -- Tons of other attributes }, ["Healthbar"] = { priority = 40, -- Tons of other attributes }, ["Powerbar"] = { priority = 35, -- Tons of other attributes }, } I need to sort this table by priorty DESC, other values does not matter. E.g. Healthbar first, then Powerbar, and then going all others. // edit. Keys must be preserved. // edit #2 Found a solution, thanks you all. local function pairsByPriority(t) local