* luci/libs/uvl: completed network scheme, add "uint" and "ipaddr" datatypes
[project/luci.git] / libs / uvl / luasrc / uvl / datatypes.lua
index 586e3f8..3dfe37d 100644 (file)
@@ -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