From 82035ea23918f2603e2cdc2b0be3f2bfac77062d Mon Sep 17 00:00:00 2001 From: dreamer Date: Mon, 30 Mar 2026 12:27:30 +0200 Subject: [PATCH] sort files and dirs --- code/hotmixes/utils.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/code/hotmixes/utils.lua b/code/hotmixes/utils.lua index 40c558a..1be42c8 100644 --- a/code/hotmixes/utils.lua +++ b/code/hotmixes/utils.lua @@ -30,6 +30,14 @@ local type_allowed = { jpg=true, jpeg=true, png=true, gif=true, mp3=true, flac=t local utils = {} +utils['compare_file'] = function(a, b) + return a["file"] < b["file"] +end + +utils['compare_dir'] = function(a, b) + return a["dir"] < b["dir"] +end + utils['request_path'] = request_path utils['data_path'] = data_path @@ -73,8 +81,8 @@ utils['these_files'] = function( path ) end table.sort( images ) - -- table.sort( files ) - -- table.sort( dirs ) + table.sort( files, utils.compare_file ) + table.sort( dirs, utils.compare_dir ) local stuff = { files = files,