Module:Items

local p={}

local function getItems(data, rarity) local o = "" data=data[rarity] local count = 0 for nam, dat in pairs(data) do       if count > 0 then o=o..'\n' end o=o..'"       count=count+1    end    return o end

function p.display(frame) local items = mw.loadData('Module:Items/data') local data = { "If a girl prefers the gift the xp given will be doubled.", " If a girl dislikes the gift the xp given will be cut in half.", '{| class="wikitable" style="text-align: center; width: 100%"', '|-',       '!',        '! Common', '! Uncommon', '! Rare', '! Epic', '! Legendary', '|-'   }    for name, dat in pairs(items) do        table.insert(data,'! '..name) table.insert(data,'| '..getItems(dat, "common")) table.insert(data,'| '..getItems(dat, "uncommon")) table.insert(data,'| '..getItems(dat, "rare")) table.insert(data,'| '..getItems(dat, "epic")) table.insert(data,'| '..getItems(dat, "legendary")) table.insert(data,'|-') end table.insert(data, '|}') for i, dat in pairs(data) do mw.log(dat) end return table.concat(data, '\n') end

return p