Module:Gems

local p = {} local cosmetic = require( 'Module:Cosmetic' )._main local getArgs = require( 'Module:Arguments' ).getArgs

function p.main(frame) local args = getArgs(frame, {   wrappers = {      'Template:Gems'    }  }) return p._main( args ) end

function p._main(args) local i, rows = 1, {} while args['item' .. i] do   local item = tostring(cosmetic({ args['item' .. i] })) local gems = {} for _,type in ipairs({ 'gem', 'spectator', 'kinetic' }) do     local n = 1 while args['item' .. i .. type .. n] do       table.insert( gems, tostring(cosmetic({ args['item' .. i .. type .. n] })) ) n = n + 1 end end gems = table.concat( gems ) table.insert( rows, string.format( '| style="vertical-align:top;" | %s || || style="vertical-align:top;" | %s', gems, item ) ) i = i + 1 end return string.format( '{| style="text-align:right;"\n%s\n|}', table.concat( rows, '\n|-\n' ) ) end

return p