Module:NeededToCraft

local util_args = require('Module:ArgsUtil') local util_cargo = require('Module:CargoUtil') local util_table = require('Module:TableUtil')

local h = {}

function h.getResult(item) local query = { tables = 'Items', fields = { 'Name' }, where = ('MadeFrom HOLDS "%s"'):format(item), groupBy = '_pageName', orderBy = 'Name' }	return util_cargo.queryAndCast(query) end

local p = {} function p.main(frame) local args = util_args.merge(true) local item = args[1] or mw.title.getCurrentTitle.text local result = h.getResult(item) if not next(result) then return 'This item is not an ingredient for any other item.' end local tbl = {} for k, row in ipairs(result) do		tbl[k] = string.format('* %s', row.Name) end return table.concat(tbl,'\n') end return p