Jump to content

Module:Decimals: Difference between revisions

Created page with "require('Module:No globals') local p = {} function p._main(n, d) local num = tonumber(n) if not num then error('Unable to convert "' .. tostring(n) .. '" to a number')..."
m (1 revision imported)
en>Vivaporius
(Created page with "require('Module:No globals') local p = {} function p._main(n, d) local num = tonumber(n) if not num then error('Unable to convert "' .. tostring(n) .. '" to a number')...")
Line 25:
function p.main(frame)
local args, pargs = frame.args, frame:getParent().args
local function work()
return p._main(mw.ext.ParserFunctions.expr(args[1] or pargs[1]), mw.ext.ParserFunctions.expr(args[2] or pargs[2]))
return p._main(
return p._main( mw.ext.ParserFunctions.expr(args[1] or pargs[1]), mw.ext.ParserFunctions.expr(args[2] or pargs[2]))
mw.ext.ParserFunctions.expr(args[2] or pargs[2])
)
end
local success, result = pcall(work)
if success then
return result
end
local errtext = args.error or pargs.error
if errtext then
return errtext
end
error(result, 0)
end
 
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.