mirror of
https://github.com/minetest-mods/skinsdb.git
synced 2025-01-09 23:50:17 +01:00
updated reading skins list
This commit is contained in:
parent
2a195a7765
commit
8713b09348
44
skinlist.lua
44
skinlist.lua
@ -1,26 +1,28 @@
|
|||||||
skins.list = {}
|
skins.list = {}
|
||||||
skins.meta = {}
|
skins.meta = {}
|
||||||
|
skins.preview = {}
|
||||||
|
|
||||||
local id = 1
|
local skins_dir_list = minetest.get_dir_list(skins.modpath.."/textures")
|
||||||
local internal_id = 1
|
for _, fn in pairs(skins_dir_list) do
|
||||||
local fetched_skip = 0
|
if fn:find("^character_") then
|
||||||
while fetched_skip < 40 do
|
nameparts = string.gsub(fn, "[.]", "_"):split("_")
|
||||||
local name = "character_"..id
|
local id = nameparts[2]
|
||||||
local file = io.open(skins.modpath.."/meta/"..name..".txt", "r")
|
local name = "character_"..id
|
||||||
if file then
|
if nameparts[3] == "preview" then
|
||||||
local data = string.split(file:read("*all"), "\n", 3)
|
skins.preview[name] = fn
|
||||||
file:close()
|
else
|
||||||
|
local file = io.open(skins.modpath.."/meta/"..name..".txt", "r")
|
||||||
skins.list[internal_id] = name
|
if file then
|
||||||
skins.meta[name] = {}
|
local data = string.split(file:read("*all"), "\n", 3)
|
||||||
skins.meta[name].name = data[1]
|
file:close()
|
||||||
skins.meta[name].author = data[2]
|
table.insert(skins.list, name)
|
||||||
skins.meta[name].license = data[3]
|
skins.meta[name] = {}
|
||||||
skins.meta[name].description = "" --what's that??
|
skins.meta[name].name = data[1]
|
||||||
|
skins.meta[name].author = data[2]
|
||||||
fetched_skip = 0
|
skins.meta[name].license = data[3]
|
||||||
internal_id = internal_id + 1
|
skins.meta[name].description = "" --what's that??
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
fetched_skip = fetched_skip + 1
|
|
||||||
id = id + 1
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user