summaryrefslogtreecommitdiff
path: root/skinlist.lua
diff options
context:
space:
mode:
authorAlexander Weber <web.alexander@web.de>2017-06-15 16:16:57 +0200
committerAlexander Weber <web.alexander@web.de>2017-06-15 16:16:57 +0200
commit0def2bbae193b7ac4a0d7e5efad44e3bbe08deed (patch)
tree96491d277ab8160266853f2af00b25a9955654a7 /skinlist.lua
parentadc435e66b69ba735795412561671f414635070f (diff)
finalized unified_inventory rework
Diffstat (limited to 'skinlist.lua')
-rw-r--r--skinlist.lua9
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