summaryrefslogtreecommitdiffhomepage
path: root/libs/uvl/luasrc
diff options
context:
space:
mode:
Diffstat (limited to 'libs/uvl/luasrc')
-rw-r--r--libs/uvl/luasrc/uvl/datatypes.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/libs/uvl/luasrc/uvl/datatypes.lua b/libs/uvl/luasrc/uvl/datatypes.lua
index 586e3f8b83..3dfe37dbef 100644
--- a/libs/uvl/luasrc/uvl/datatypes.lua
+++ b/libs/uvl/luasrc/uvl/datatypes.lua
@@ -31,6 +31,15 @@ function boolean( val )
return false
end
+function uint( val )
+ local n = tonumber(val)
+ if n ~= nil and math.floor(n) == n and n >= 0 then
+ return true
+ end
+
+ return false
+end
+
function integer( val )
local n = tonumber(val)
if n ~= nil and math.floor(n) == n then
@@ -44,6 +53,10 @@ function float( val )
return ( tonumber(val) ~= nil )
end
+function ipaddr( val )
+ return ip4addr(val) or ip6addr(val)
+end
+
function ip4addr( val )
if val then
return luci.ip.IPv4(val) and true or false