local p = local getArgs = require('Module:Arguments').getArgs
function p.main(frame) local args = getArgs(frame) return frame:expandTemplate -- return mw.dumpObject(args)end
function p._main(args) local value = args[1] or nil local cf = args[2] or nil local rd = args[3] or nil local lk = args['lk'] or nil local year = args['year'] or nil local to = args['to'] or nil local mode = args['mode'] or nil -- check_value(value, 'number') cf = check_cf(cf) lk = check_lk(lk) local paisaResult = paisa(value, cf, lk) if paisaResult[1] then return paisaResult[2] end return rupee(value, cf, lk)end
function check_value(value, typeString) assert(type(value)
function check_cf(cf) if cf
'string') cf = mw.ustring.lower(cf) assert(cf
'm' or cf
't' or cf
'c' or cf
-- ToDo Dedupfunction check_lk(cf) if cf
'string') cf = mw.ustring.lower(cf) assert(cf
'r' or cf
't' or cf
'c' or cf
function paisa(value, cf, lk) -- ToDo Support ranges value = tonumber(value) if value >= 1 or cf ~= nil then return end local paisa = value * 100 local word = 'pais' .. (paisa
'on' or lk
function rupee(value, cf, lk) -- ToDo Support ranges value = tonumber(value) -- ToDo Incorrect, use frame:expandTemplate local word = (lk
'r') and 'Indian Rupee' or 'Indian Rupee' word = '
' .. word local lang = mw.getContentLanguage local function formatnum(num) return lang:parseFormattedNumber(num) and lang:formatNum(lang:parseFormattedNumber(num)) or num end if cf'm' then word = word .. formatnum(value) .. ' million' elseif cf
'on' or lk
't' then local trillion = (lk
't') and ' trillion' or ' trillion' word = word .. formatnum(value) .. trillion elseif cf
'on' or lk
'c' then local crore = (lk
'c') and ' crore' or ' crore' word = word .. formatnum(value) .. crore elseif cf
'on' or lk
'on' or lk
return p