Modul:RecipeAnalysisTransclusion

Aus Satisfactory Wiki
Zur Navigation springen Zur Suche springen

Die Dokumentation für dieses Modul kann unter Modul:RecipeAnalysisTransclusion/Doku erstellt werden

local cargo = mw.ext.cargo

local p = {}

local function getProductRecipes(product, alternateOnly)
	local tables = 'crafting_recipes'
	local fields = 'product, recipeName, alternateRecipe'
	local args = { where = '(product="' .. product .. '")' .. (alternateOnly and ' and (alternateRecipe=True)' or ''),
		orderBy = 'recipeName ASC'}
	
	local recipes = cargo.query(tables, fields, args)
	local recipesList = {}
	for i = 1, #recipes do
		recipesList[i] = recipes[i].recipeName
	end
	mw.logObject(recipesList)
	return recipesList
end

function p.getProductAnalyses(frame)
	local product = frame.args[1]
	local recipes = getProductRecipes(product, true)
	
	local html = ''
	for _, recipe in pairs(recipes) do
		html = html .. frame:callParserFunction('#lst:User:Ondar111/sandbox', recipe)
	end
	return html
end
	
return p