Module:Utils

local getArgs = require('Dev:Arguments').getArgs local language = mw.language.getContentLanguage local userError = require('Dev:User error') return { error_message = function(...) return userError(..., "Pages with script errors") end; make_wrapper_function = function(func) return function(frame) return func(getArgs(frame)) end end; parse_number = function(num, error_if_invalid) if type(num) == 'number' then return num elseif type(num) == 'string' then local number = tonumber(language:parseFormattedNumber(num)) if number then return number elseif error_if_invalid then return error(num .. " is not a valid number") end elseif error_if_invalid then return error(tostring(num) .. " is not a valid number") end end; format_number = function(number) return language:formatNum(number) end; }