mirror of
https://github.com/minetest-mods/skinsdb.git
synced 2025-01-09 07:30: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.meta = {}
|
||||
skins.preview = {}
|
||||
|
||||
local id = 1
|
||||
local internal_id = 1
|
||||
local fetched_skip = 0
|
||||
while fetched_skip < 40 do
|
||||
local name = "character_"..id
|
||||
local file = io.open(skins.modpath.."/meta/"..name..".txt", "r")
|
||||
if file then
|
||||
local data = string.split(file:read("*all"), "\n", 3)
|
||||
file:close()
|
||||
|
||||
skins.list[internal_id] = 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??
|
||||
|
||||
fetched_skip = 0
|
||||
internal_id = internal_id + 1
|
||||
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
|
||||
end
|
||||
fetched_skip = fetched_skip + 1
|
||||
id = id + 1
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user