因为以下原因,您没有权限编辑本页:
您可以查看和复制此页面的源代码。
local common = {}
--- Convert an input to number
--- @param num string|integer Input
--- @param onFail string|integer Output if conversion fails
--- @param base integer Base for tonumber, defaults to 10
--- @return number
function common.toNumber( num, onFail, base )
base = base or 10
if num == nil then
return onFail
end
local numCopy = num
if type( num ) == 'string' then
numCopy = num:gsub( ',', '.' )
end
numCopy = tonumber( numCopy, base )
000
1:0
本页使用的模板:
- 模板:Documentation(查看源代码)
- 模块:Arguments(查看源代码)
- 模块:Array(查看源代码)
- 模块:Common(查看源代码)
- 模块:Common/doc(查看源代码)
- 模块:DPLlua(查看源代码)
- 模块:DependencyList(查看源代码)
- 模块:Documentation(查看源代码)
- 模块:Documentation/config(查看源代码)
- 模块:Documentation/styles.css(查看源代码)
- 模块:Format link(查看源代码)
- 模块:Hatnote(查看源代码)
- 模块:Hatnote list(查看源代码)
- 模块:Mbox(查看源代码)
- 模块:Paramtest(查看源代码)
- 模块:User error(查看源代码)
- 模块:Yesno(查看源代码)
返回模块:Common。