![]() |
VOOZH | about |
This module is used to list all recipes in a particular category.
The type function will match recipes which have the type parameter set to the same value as the input.
{{#invoke:recipe list|type|Foodstuff}}, lists all recipes with type set to Foodstuff.
localp={} functionp.type(f) localargs=f.args localcrafting=require([[Module:Crafting]]).table localtype=mw.text.trim(args[1]) localshowDescription localtemplates={} localdata=bucket('crafting_recipe') .select('type','json') .where('type',type) .run() ifdatathen for_,vinipairs(data)do localtArgs=mw.text.jsonDecode(v['json']) iftArgs.descriptionthen showDescription=true end tArgs.ignoreusage='1' table.insert(templates,tArgs) end end if#templates==0then return end templates[1].head='1' templates[1].showname='1' ifshowDescriptionandargs.showdescription~='0'orargs.showdescription=='1'then templates[1].showdescription='1' end ifnotargs.continuethen templates[#templates].foot='1' end localout={} fori,vinipairs(templates)do table.insert(out,crafting(v)) end returntable.concat(out,'\n') end returnp