Module:Currency

local p = {}

local function getArgs(frame) local args = {} for key, value in pairs(frame:getParent.args) do       args[key] = value end for key, value in pairs(frame.args) do       args[key] = value end return args end

function p.main(frame) local args     = getArgs(frame) local nolink   = args.nolink or '' local short    = args.short or '' local size     = args.size or '' local note     = args.note or '' local currency = args[1] or args.currency or '' local num      = args[2] or args.num or '' local noimages = args.noimages or '' return p.outputCurrency(currency, num, nolink, note, short, size, frame, noimages) end

function p.outputCurrency(currency, num, nolink, note, short, size, frame, noimages) local formatnum local function isEmpty(s) return s == nil or s == '' end local function tableEmpty(s) return next(s) == nil end local data = { ["Bells"] = { "99k Bells NH Inv Icon cropped.png", "15px", "Bell", "Bell", "Bell" }, ["Caps"] = { "Cap PC Icon.png", "15px", "Cap", "Cap", "Cap" }, ["Play Coins"] = { "Play Coins Icon.png", "15px", "Play Coins", "Play Coin", "Play Coin" }, ["Medals"] = { "Medal NL Icon.png", "18px", "Medals", "Medal", "Medal" }, ["MEOW Coupons"] = { "MEOW Coupon Icon.png", "18px", "MEOW Coupons", "MEOW Coupon", "Coupon" }, ["Leaf Tickets"] = { "Leaf Ticket PC Icon.png", "15px", "Leaf Ticket", "Leaf Ticket", "Ticket" }, ["Nook Miles"] = { "Nook Miles NH Icon Cropped.png", "18px", "Nook Miles", "Nook Mile", "Mile" }, ["Heart Crystals"] = { "Heart Crystal NH Inv Icon.png", "15px", "Item:Heart Crystal (New Horizons)", "Heart Crystal", "Heart Crystal" }, ["Saharah Tickets"] = { "Saharah Ticket NH Inv Icon.png", "15px", "Item:Saharah Ticket (New Horizons)", "Saharah Ticket", "Saharah Ticket" }, ["Nook Points"] = { "Nook Points NH Icon.svg", "18px", "NookLink#Nook Points", "Nook Point", "Point" }, ["Points"] = { "", "", "Tom Nook Point System", "Point", "Point" }, ["Happy Points"] = { "Happy Point aF Icon.png", "15px", "Happy Point", "Happy Point", "Happy Point" }, ["Happy Tickets"] = { "", "", "Happy Ticket", "Happy Ticket", "Happy Ticket" }, ["Poki"] = { "Poki NH Inv Icon cropped.png", "15px", "Poki", "Poki", "Poki" }, ["Gold Points"] = { "My Nintendo Gold Point.png", "15px", "My Nintendo", "Gold Point", "Point" }, ["Platinum Points"] = { "My Nintendo Platinum Point.png", "15px", "My Nintendo", "Platinum Point", "Point" }, ["Platinum Points (PC)"] = { "My Nintendo Platinum Point PC.png", "15px", "My Nintendo", "Platinum Point", "Point" } }	local print = '' if not isEmpty(currency) then if not isEmpty(data[currency][1]) and isEmpty(noimages) then print = print .. ' '		end if not isEmpty(num) then formatnum = require("Module:Formatnum") print = print .. formatnum.formatNum(num,"en") end print = print .. ' '		if not isEmpty(nolink) then if not isEmpty(short) then print = print .. data[currency][5] if (num == 1) or currency == "Poki" then print = print .. ''				else print = print .. 's'				end else print = print .. data[currency][4] if (num == 1) or currency == "Poki" then print = print .. ''				else print = print .. 's'				end end else if not isEmpty(short) then print = print ..  .. data[currency][5]				if (num == 1) or currency == "Poki" then					print = print .. 				else					print = print .. 's'				end				print = print .. '' else print = print ..  .. data[currency][4]				if (num == 1) or currency == "Poki" then					print = print .. 				else					print = print .. 's'				end				print = print .. '' end end end if not isEmpty(note) then print = print .. frame:expandTemplate{ title = 'Note', args = { note }} end return print end

return p