diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2008-09-03 01:45:43 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2008-09-03 01:45:43 +0000 |
commit | 2b767fc45c564b94df4153d99d5501bb208e6fe5 (patch) | |
tree | 736960a4a496ef6be1ebb84744646d9b03d73c19 /libs/uvl/luasrc | |
parent | c842b668b0ada4757aca0f7feccf041a24628b2b (diff) |
* luci/libs/uvl: completed network scheme, add "uint" and "ipaddr" datatypes
Diffstat (limited to 'libs/uvl/luasrc')
-rw-r--r-- | libs/uvl/luasrc/uvl/datatypes.lua | 13 |
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 |