skinsdb/skinlist.lua

29 lines
787 B
Lua
Raw Normal View History

skins.list = {}
skins.meta = {}
2017-06-15 13:45:42 +02:00
skins.preview = {}
2014-03-17 06:26:58 +01:00
2017-06-15 13:45:42 +02:00
local skins_dir_list = minetest.get_dir_list(skins.modpath.."/textures")
for _, fn in pairs(skins_dir_list) do
if fn:find("^character_") then
nameparts = string.gsub(fn, "[.]", "_"):split("_")
local id = nameparts[2]
local name = "character_"..id
if nameparts[3] == "preview" then
skins.preview[name] = fn
else
local file = io.open(skins.modpath.."/meta/"..name..".txt", "r")
if file then
local data = string.split(file:read("*all"), "\n", 3)
file:close()
table.insert(skins.list, name)
skins.meta[name] = {}
skins.meta[name].name = data[1]
skins.meta[name].author = data[2]
skins.meta[name].license = data[3]
skins.meta[name].description = "" --what's that??
end
end
2014-07-23 13:46:42 +02:00
end
end
2017-06-15 13:45:42 +02:00