Module:Number
Documentation for this module may be created at Module:Number/doc
--[[
Library for common number conversions.
]]
local p = {}
--probably worth revisiting this one and using string.format?
function p.to_hex(frame)
local num = tonumber(frame.args.num);
if(num == nil) then
return error("Provided argument (" .. frame.args.num .. "), cannot be converted to hexadecimal")
end
return num;
end
function p.format(frame)
local format = "%.2f"
local result
if (frame.args.format ~= nil) then
format = frame.args.format
end
result = string.format(format, frame.args.num)
return result;
end
return p