diff options
Diffstat (limited to 'skinlist.lua')
-rw-r--r-- | skinlist.lua | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/skinlist.lua b/skinlist.lua index 889b531..0a06f5d 100644 --- a/skinlist.lua +++ b/skinlist.lua @@ -82,3 +82,16 @@ function skins.get_skinlist_for_player(playername) table.sort(skinslist, function(a,b) return a:get_meta("_sort_id") < b:get_meta("_sort_id") end) return skinslist end + +-- Get skinlist selected by metadata +function skins.get_skinlist_with_meta(key, value) + assert(key, "key parameter for skins.get_skinlist_with_meta() missed") + local skinslist = {} + for _, skin in pairs(skins.meta) do + if skin:get_meta(key) == value then + table.insert(skinslist, skin) + end + end + table.sort(skinslist, function(a,b) return a:get_meta("_sort_id") < b:get_meta("_sort_id") end) + return skinslist +end |