Skip to content

Commit b7ac694

Browse files
committed
sort outfit folders in the load/save editor menu
1 parent f339571 commit b7ac694

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

lua/pac3/editor/client/saved_parts.lua

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,24 @@ local function populate_part(menu, part, override_part, clear)
448448
end
449449

450450
local function populate_parts(menu, tbl, override_part, clear)
451-
for key, data in pairs(tbl) do
451+
local files = {}
452+
local folders = {}
453+
local sorted_tbl = {}
454+
for k,v in pairs(tbl) do
455+
if isstring(k) then
456+
folders[k] = v
457+
elseif isnumber(k) then
458+
files[k] = v
459+
end
460+
end
461+
462+
for k,v in ipairs(files) do table.insert(sorted_tbl, {k,v}) end
463+
for k,v in SortedPairs(folders) do table.insert(sorted_tbl, {k,v}) end
464+
465+
--for key, data in pairs(tbl) do
466+
for i, tab in ipairs(sorted_tbl) do
467+
local key = tab[1]
468+
local data = tab[2]
452469
if not data.Path then
453470
local menu, pnl = menu:AddSubMenu(key, function() end, data)
454471
pnl:SetImage(pace.MiscIcons.load)

0 commit comments

Comments
 (0)