diff options
Diffstat (limited to 'skinlist.lua')
-rw-r--r-- | skinlist.lua | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/skinlist.lua b/skinlist.lua index b38246f..e050497 100644 --- a/skinlist.lua +++ b/skinlist.lua @@ -1,8 +1,10 @@ skins.list = {} +skins.textures = {} skins.meta = {} skins.preview = {} local skins_dir_list = minetest.get_dir_list(skins.modpath.."/textures") +local unsorted_skinslist = {} for _, fn in pairs(skins_dir_list) do if fn:find("^character_") then nameparts = string.gsub(fn, "[.]", "_"):split("_") @@ -15,7 +17,8 @@ for _, fn in pairs(skins_dir_list) do if file then local data = string.split(file:read("*all"), "\n", 3) file:close() - skins.list[name] = fn + table.insert(unsorted_skinslist, {id = tonumber(id) or id, name = name}) + skins.textures[name] = fn skins.meta[name] = {} skins.meta[name].name = data[1] skins.meta[name].author = data[2] @@ -26,3 +29,7 @@ for _, fn in pairs(skins_dir_list) do end end +table.sort(unsorted_skinslist, function(a,b) return a.id < b.id end) +for _,v in ipairs(unsorted_skinslist) do + table.insert(skins.list, v.name) +end |