Content added Content deleted
(Created page with "local recipelist = mw.text.jsonDecode(mw.getCurrentFrame():expandTemplate{title='Template:Recipes.json'}) local p = {} p.getRecipe = function(frame) local result = frame.args[1] for i=1, #recipelist, 1 do if recipelist[i][1] == result then local txt = frame.expandTemplate{ title = "Recipe", args = { result = recipelist[i][1] } } end end return txt end return p") |
No edit summary |
||
Line 6: | Line 6: | ||
local result = frame.args[1] |
local result = frame.args[1] |
||
for i=1, #recipelist, 1 do |
for i=1, #recipelist, 1 do |
||
if recipelist[i][ |
if recipelist[i]["output-name"] == result then |
||
local txt = frame.expandTemplate{ title = "Recipe", args = { result = recipelist[i][ |
local txt = frame.expandTemplate{ title = "Recipe", args = { result = recipelist[i]["output-name"] } } |
||
end |
end |
||
end |
end |
Revision as of 19:23, 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 i=1, #recipelist, 1 do
if recipelist[i]["output-name"] == result then
local txt = frame.expandTemplate{ title = "Recipe", args = { result = recipelist[i]["output-name"] } }
end
end
return txt
end
return p