Module:Utils: Difference between revisions

Fredg999 (talk | contribs)
Added input check, fixed how arguments work (I hope)
Fredg999 (talk | contribs)
Bug fixing
Line 26: Line 26:


-- return x rounded to a precision of p decimal places
-- return x rounded to a precision of p decimal places
function p.round(x, prec)
function p.round(x, frame)
-- x defaults to 0 if omitted
-- x defaults to 0 if omitted
local x = eval_num_arg(frame.args[1], 0)
local x = eval_num_arg(frame.args[1], 0)