Module:KnightMiner/Sandbox

local p = {} p.resource = function( f ) local args = f	if f == mw.getCurrentFrame then args = require( 'Module:ProcessArgs' ).merge( true ) end local resource = args[1] or '' local product = args[2] or '' local grid = require( 'Module:Grid' ).cell local output = {}

local title if args.title or  ~=  then title = args.title else title =  .. resource ..  end

local icon = function( var ) local out = {} for icons in mw.text.gsplit( var, '%s*,%s*' ) do			table.insert( out, grid{ icons, class = 'plain' } ) end return table.concat( out ) end

local resourceicon if args.file or  ~=  then resourceicon = '' elseif resource ~= '' then resourceicon = icon( resource ) else resourceicon = '' end

table.insert( output, '| align="center" | ' .. title .. ' ' .. resourceicon )

local align = 'center' if f:callParserFunction( '#var', 'renewable-method' ) ~= '' then align = 'left' end

local products if args.product or  ~=  then products = args.product elseif product ~= '' then products = icon( product ) else products = '—' end

table.insert( output, '| align="' .. align .. '" | ' .. products )

if f:callParserFunction( '#var', 'renewable-method' ) == '' then table.insert( output, '|\n' .. ( args[3] or '' ) ) end

table.insert( output, '|-' )

return table.concat( output, '\n' ) end return p