Module:Decorations

local p = {} p.deco = mw.loadData('Module:Decorations/data') p.config = { } local f = require('Module:Functions')

function benefit(value) stars = "" local val = value if(val ~= math.floor(val)) then stars = "" end val = math.floor(val) while val>0 do		stars = ""..stars val = val-1 end return stars end

function costType(type) if(string.match("kiss",type)) then return "" end if(string.match("money",type)) then return "" end return " "..type end

function decos(j) local data = "" for k, l in pairs(j) do		req = "" event = "" if(l.playerLvl ~= nil) then req = " Player level "..l.playerLvl	end if(l.event ~= nil) then event = ' <span style="font-size:7px;"'..l.event..' ' end data = data.." "..l.name.." "..benefit(l.benefit).." "..event.." "..l.cost..costType(l.costType)..req.." " end return data end function p.table local data = { ' ',		'{| class="wikitable mw-datatable" style="text-align: center;"', '|-'	}	for i, j in pairs(p.deco) do		table.insert(data, '!'..f.upfirst(i)) table.insert(data, '|'..decos(j)) table.insert(data, '|-') end table.insert(data, '|}') table.insert(data, ' ') return table.concat(data,"\n") end

return p