Module:Currency: Difference between revisions

From The Satanic Wiki
Jump to navigation Jump to search
m (1 revision imported)
No edit summary
 
Line 2: Line 2:
-- Shows currency information based on ISO 4217
-- Shows currency information based on ISO 4217
local p = {}
local p = {}
local data = mw.loadData("Dev:Currency/data")
local data = mw.loadData("Module:Currency/data")
local getArgs = require("Dev:Arguments").getArgs
local getArgs = require("Module:Arguments").getArgs


local function getCurrencyInfo(currencyCode, currencyInfo)
local function getCurrencyInfo(currencyCode, currencyInfo)

Latest revision as of 05:11, 2 May 2021

Documentation for this module may be created at Module:Currency/doc

-- <nowiki>
-- Shows currency information based on ISO 4217
local p = {}
local data = mw.loadData("Module:Currency/data")
local getArgs = require("Module:Arguments").getArgs

local function getCurrencyInfo(currencyCode, currencyInfo)
    local currency = data[currencyCode:upper()]

    if currency and currency[currencyInfo] then
        return currency[currencyInfo]
    end
end

function p.main(frame)
	local args = getArgs(frame)
    return getCurrencyInfo(frame.args[1], frame.args[2])
end

return p