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 "neg()" cbi datatype to negate arbritary types, e.g. "neg(hostname...
[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
6640db6
..
fc3048e
100644
(file)
--- a/
libs/web/luasrc/cbi/datatypes.lua
+++ b/
libs/web/luasrc/cbi/datatypes.lua
@@
-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