Module:Pokemon/Shop

local getArgs = require('Module:Arguments').getArgs

local p = {} local root

local function _shop local itemName = {} local itemPricing = {} local itemList = mw.loadJsonData( 'Module:Pokemon/ShopPricing.json' )

for k,v in pairs(args) do       itemName[k] = args[k] itemPricing[k] = itemList[itemName[k]] end

root = mw.html.create( 'table' ) root :addClass( 'wikitable' ) :addClass( 'bordered' ) :tag( 'tr' ) :tag( 'th' ) :attr( 'colspan', 2 ) :cssText( 'background-color:#0000BD;' ) :cssText( 'color:white;' ) :wikitext( args.title ) if args.cashier then root :tag( 'tr' ) :tag( 'td' ) :attr( 'colspan', 2 ) :cssText( 'text-align:center;' ) :wikitext( args.cashier ) for k,v in ipairs(itemName) do      root :tag( 'tr' ) :tag( 'td' ) :wikitext( itemName[k] ) :tag( 'td' ) :wikitext( '', itemPricing[k] ) end else for k,v in ipairs(itemName) do         root :tag( 'tr' ) :tag( 'td' ) :wikitext( itemName[k] ) :tag( 'td' ) :wikitext( '', itemPricing[k] ) end end return tostring( root ) end

function p.shop( frame ) args = getArgs( frame, { wrappers = 'Template:Pokemon/Shop' } )

return _shop end

return p