libs/web: add "neg()" cbi datatype to negate arbritary types, e.g. "neg(hostname...
[project/luci.git] / libs / web / luasrc / cbi / datatypes.lua
index 6640db6..fc3048e 100644 (file)
@@ -267,3 +267,11 @@ function max(val, max)
 
        return false
 end
+
+function neg(val, what)
+       if what and type(_M[what]) == "function" then
+               return _M[what](val:gsub("^%s*!%s*", ""))
+       end
+
+       return false
+end