summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--init.lua4
-rw-r--r--sfinv_page.lua3
-rw-r--r--skin_meta_api.lua4
-rw-r--r--skinlist.lua3
4 files changed, 8 insertions, 6 deletions
diff --git a/init.lua b/init.lua
index 93a16ca..b9abc7a 100644
--- a/init.lua
+++ b/init.lua
@@ -9,7 +9,7 @@ skins = {}
skins.modpath = minetest.get_modpath(minetest.get_current_modname())
skins.default = "character_1"
-dofile(skins.modpath.."skin_meta_api.lua")
+dofile(skins.modpath.."/skin_meta_api.lua")
dofile(skins.modpath.."/api.lua")
dofile(skins.modpath.."/skinlist.lua")
@@ -30,6 +30,6 @@ if minetest.global_exists("armor") then
end
armor.get_preview = function(self, name)
local skin = skins.get_player_skin(minetest.get_player_by_name(name))
- return skin:get_meta("preview")
+ return skin:get_preview()
end
end
diff --git a/sfinv_page.lua b/sfinv_page.lua
index 1155a71..060eb12 100644
--- a/sfinv_page.lua
+++ b/sfinv_page.lua
@@ -11,7 +11,8 @@ local dropdown_values = {}
-- collect skins data
local total_pages = 1
for i, skin in ipairs(skins.list) do
- skin:set_meta("inv_page", math.floor((i-1) / 16)+1)
+ local page = math.floor((i-1) / 16)+1
+ skin:set_meta("inv_page", page)
skin:set_meta("inv_page_index", (i-1)%16+1)
total_pages = page
end
diff --git a/skin_meta_api.lua b/skin_meta_api.lua
index 9e681c0..367dee1 100644
--- a/skin_meta_api.lua
+++ b/skin_meta_api.lua
@@ -12,9 +12,9 @@ function skins.new(key, object)
setmetatable(self, skin_class)
self.__index = skin_class
- self._key, key)
+ self._key = key
self._sort_id = 0
- skins.meta[key]
+ skins.meta[key] = self
return self
end
diff --git a/skinlist.lua b/skinlist.lua
index da59a47..5b074fd 100644
--- a/skinlist.lua
+++ b/skinlist.lua
@@ -7,7 +7,7 @@ for _, fn in pairs(skins_dir_list) do
nameparts = string.gsub(fn, "[.]", "_"):split("_")
local id = nameparts[2]
local name = "character_"..id
- local skin_obj = skins.get(name) or skins.new(new)
+ local skin_obj = skins.get(name) or skins.new(name)
if nameparts[3] == "preview" then
skin_obj:set_preview(fn)
else
@@ -21,6 +21,7 @@ for _, fn in pairs(skins_dir_list) do
skin_obj:set_meta("author", data[2])
skin_obj:set_meta("license", data[3])
end
+ table.insert(unsorted_skinslist, skin_obj)
end
end
end