Module:Recipe: Difference between revisions

From Veloren Wiki
Content added Content deleted
No edit summary
No edit summary
Line 8: Line 8:
if v['output-name'] == result then
if v['output-name'] == result then
output_name = '[[Image:' .. 'veloren_' .. v['output-name'] .. '.png|link=]] ' .. v['output-name']
output_name = '[[Image:' .. 'veloren_' .. v['output-name'] .. '.png|link=]] ' .. v['output-name']
for k1, v1 in pairs(recipelist[3]) do
for i=1, #recipelist['inputs'], 1 do
inputs = v1[1]
inputs = recipelist[1]
end
end
end
end

Revision as of 19:59, 16 February 2022

Documentation for this module may be created at Module:Recipe/doc

local recipelist = mw.text.jsonDecode(mw.getCurrentFrame():expandTemplate{title='Template:Recipes.json'})

local p = {}

p.getRecipe = function(frame)
	local result = frame.args[1]
	for k, v in pairs(recipelist) do
		if v['output-name'] == result then
			output_name = '[[Image:' .. 'veloren_' .. v['output-name'] .. '.png|link=]] ' .. v['output-name']
			for i=1, #recipelist['inputs'], 1 do
				inputs = recipelist[1]
			end
		end
	end
	txt = frame:expandTemplate{ title = 'Recipe', args = { result = output_name , ingredients = inputs} }
	return txt
end

return p
Cookies help us deliver our services. By using our services, you agree to our use of cookies.