Module:Sandbox/Ninjamask/Recipe

-- local p = {} local lib = require('Module:Feature')

function p.recipe(frame) local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end local recipe = recipePart(args[1]) return lib.tbl(recipe) end

function recipePart(item) local frame = mw.getCurrentFrame local recipe = {} local g_buy = 0 local g_comb = 0 local s     = "" if item == nil then return {item} end item = mw.text.trim(item) pst2recipe = pst2recipe(item) pst2buy   = pst2buy(item)

if pst2recipe == '' then return {[item] = pst2buy} end for part in pst2recipe:gmatch("[^,]+") do       recipe[#recipe+1] = {[recipePart(part)] = pst2buy} end return {item, recipe} end

function pst2recipe(item) local frame = mw.getCurrentFrame return frame:expandTemplate{ title = 'Item data '.. item, args = {'pst2', 'recipe'} } end

function pst2buy(item) local frame = mw.getCurrentFrame return frame:expandTemplate{ title = 'Item data '.. item, args = {'pst2', 'buy'} } end

return p --