Module:Sandbox

local p = {}

function p.outputItemList(frame) local data = mw.text.jsonDecode(mw.text.decode(frame.args['1'])) local itemList = "" for k, item in pairs(data) do       itemList = itemList .. item['link'] itemList = itemList .. '\n' end return itemList end

function isEmpty(s) return s == nil or s == '' end

function fighterFormat(fighter) if fighter == 'Villager' then return 'Villager' elseif fighter == 'Isabelle' then return 'Isabelle' else return  .. fighter ..  end end

function p.outputEnemies(frame) local data = mw.text.jsonDecode(mw.text.decode(frame.args['1'])) local enemy = "" for k, e in pairs(data) do enemy = enemy .. "" if not isEmpty(e['fighter-condition']) then enemy = enemy .. e['fighter-condition'] .. " "   	end if not isEmpty(e['fighter-variant']) then enemy = enemy .. e['fighter-variant'] .. " "   	end enemy = enemy .. fighterFormat(e['fighter']) .. "" end return enemy end

function p.outputRules(frame) local data = mw.text.jsonDecode(mw.text.decode(frame.args['1'])) local rules = "" for k, r in pairs(data) do rules = rules .. "" .. r['rule'] .. "" end return rules end

function p.outputConditions(frame) local data = mw.text.jsonDecode(mw.text.decode(frame.args['1'])) local conditions = "" for k, r in pairs(data) do conditions = conditions .. "" .. r['condition'] .. "" end return conditions end return p