Module:Spellfireapps

local Spellfireapps = {} --- imported libraries -- Parses invocation and template parameters, trims whitespace, and removes blanks. local getArgs = require('Dev:Arguments').getArgs --- local data with allowed abbreviations. local SpellfireData = mw.loadData( 'Module:Spellfireapps/data' ) -- This is the default output if no arguments are specified. local output = "Spellfire" -- This is the publisher of the Spellfire cards local publisher = "TSR, Inc."

-- function Spellfireapps.SpellfireAppearances (frame) -- interprets parameters local args = getArgs(frame) -- calls the internal function that does most of the work -- sends the result back to the template / article return Spellfireapps._SpellfireAppearances(args) end

-- function Spellfireapps.CiteSpellfire (frame) -- interprets parameters local args = getArgs(frame) -- calls the internal function that does most of the work -- sends the result back to the template / article return Spellfireapps._CiteSpellfire(args) end

function Spellfireapps._SpellfireAppearances(args) if args[1] then output = output..' ('		for _,v in ipairs(args) do			output = output....v....' • '		end		-- Remove the trailing ' • ' and close the span.		output = mw.ustring.sub(output, 1, -4)..') ' end

return output end

function Spellfireapps._CiteSpellfire(args) local set, card_number, name, illustrator if args[1] or args["set"] then set = args[1] or args["set"] output = output..' ('..SpellfireData[set][1]..'). ' -- add date output = output..' '..set..'' -- add link to set end if args[2] or args["card number"] then card_number = args[2] or args["card number"] output = output..' #'..card_number -- add card number end if args[3] or args["name"] then name = args[3] or args["name"] output = output..' "'..name..'"' -- add card name end if args[4] or args["illustrator"] then illustrator = args[4] or args["illustrator"] output = output..', illus. '..illustrator..'.' -- add illustrator end output = output..' '..publisher..'.' -- add publisher return output end

return Spellfireapps