Module:PetLists

local this = {} local eggs = require('Module:Utils/Eggs')

local begin = '\n{| align="center"\n|-'

local ending = '\n|} '

local splitter = '|-' local adder = '!' local template = ''

function this.returnData( frame ) if eggs[frame:preprocess('')] then local data = eggs[frame:preprocess('')] local sortedPets = {} for k, v in pairs(data.Pets) do			table.insert(sortedPets, {Name = k, Rarity = v.Rarity, Chance = v.Chance}) end table.sort(sortedPets, function(a,b)			return a.Chance > b.Chance			end) local list = '' local i = 0; for _, v in pairs(sortedPets) do			i=i+1 list = ('%s\n%s%s'):format(list, adder, template:format(v.Name, v.Rarity:lower, v.Chance.. "%"))			if i%3==0 then list = ('%s\n%s'):format(list, splitter) end end return frame:preprocess( ("%s%s%s"):format(begin, list, ending) ) end end

return this