Module:Item pool

local p = {} local rtable = require( 'Module:Table' )

function p.main( f ) local args = rtable.trimAll( rtable.getArgs( f ) ) local content = {} local i = 1 repeat data = mw.text.split( args[i], ':' ) data[1] = mw.text.trim( data[1] ) if data[1] == 'a' or data[1] == 'a+' then local dlc = table.remove( data, 1 ) content[i] = f:expandTemplate{ title = 'item', args = { table.concat( data ), dlc .. ':table' } } else content[i] = f:expandTemplate{ title = 'item', args = { args[i], 'table' } } end if args['insert'..i] then content[i] = f:preprocess( '|-\n' .. args['insert'..i] .. '\n|-' ) .. ' ' .. content[i] end i = i + 1 until not args[i] return table.concat( content ) end

function p.search( f ) local args = rtable.trimAll( rtable.getArgs( f ) ) local data local i = 1 repeat data = mw.text.split( args[i], ':' ) data[1] = mw.text.trim( data[1] ) if data[1] == 'a' or data[1] == 'a+' then local dlc = table.remove( data, 1 ) if args.item == table.concat( data ) then return dlc end else if args.item == args[i] then return 'r'			end end i = i + 1 until not args[i] return nil end

return p