projects
/
project
/
luci.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
libs/web: add float and ufloat datatypes for field validation
[project/luci.git]
/
libs
/
web
/
luasrc
/
cbi
/
datatypes.lua
diff --git
a/libs/web/luasrc/cbi/datatypes.lua
b/libs/web/luasrc/cbi/datatypes.lua
index
2fdb580
..
62f06c4
100644
(file)
--- a/
libs/web/luasrc/cbi/datatypes.lua
+++ b/
libs/web/luasrc/cbi/datatypes.lua
@@
-35,7
+35,7
@@
function bool(val)
return false
end
return false
end
-function uint(val)
+function uint
eger
(val)
local n = tonumber(val)
if n ~= nil and math.floor(n) == n and n >= 0 then
return true
local n = tonumber(val)
if n ~= nil and math.floor(n) == n and n >= 0 then
return true
@@
-44,7
+44,7
@@
function uint(val)
return false
end
return false
end
-function int(val)
+function int
eger
(val)
local n = tonumber(val)
if n ~= nil and math.floor(n) == n then
return true
local n = tonumber(val)
if n ~= nil and math.floor(n) == n then
return true
@@
-53,6
+53,11
@@
function int(val)
return false
end
return false
end
+function ufloat(val)
+ local n = tonumber(val)
+ return ( n ~= nil and n >= 0 )
+end
+
function float(val)
return ( tonumber(val) ~= nil )
end
function float(val)
return ( tonumber(val) ~= nil )
end