Module:Crafted in

local util_args = require('Module:ArgsUtil') local p = {} local cargo = mw.ext.cargo

p.argList = { 'productCount', 'name', 'craftingTime', 'ingredient1', 'quantity1', 'ingredient2', 'quantity2', 'ingredient3', 'quantity3', 'ingredient4', 'quantity4', 'ingredient5', 'quantity5', 'ingredient6', 'quantity6', 'ingredient7', 'quantity7', 'ingredient8', 'quantity8', 'ingredient9', 'quantity9', 'ingredient10', 'quantity10' }

--Creates recipe table for given recipes -- local function createTable(recipes) local tbl = {} for i, recipe in ipairs(recipes) do		if i == #recipes then recipe.foot = 1 end recipe.structure = 'hidden' tbl[i] = mw.getCurrentFrame:expandTemplate{title='CraftingTable', args=recipe} end return table.concat(tbl) end

p.table = function(frame) if args[0] then local building = args[0] else local building = mw.title.getCurrentTitle.text end local fields = table.concat(p.argList, ',') local args = { where = 'craftedIn="' .. building .. '"', orderBy = 'name ASC' }

local recipes = cargo.query('crafting_recipes', fields, args)

return createTable(recipes) end

return p