Module:Recipe: Difference between revisions

From Veloren Wiki
Content added Content deleted
(Undo revision 6639 by Scott Williams (talk))
Tag: Undo
No edit summary
 
(25 intermediate revisions by the same user not shown)
Line 2: Line 2:


local p = {}
local p = {}
local i = 0
local subs = {}


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



Latest revision as of 20:36, 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 = {}
local i = 0
local subs = {}

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']
		end
		for k1, v1 in (recipelist[3]) do
		inputs = v1[1]
		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.