From 794094caa20d922d968b4615f44a189f25f48a5e Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sun, 4 Sep 2011 12:07:43 +0000 Subject: libs/web: add "neg()" cbi datatype to negate arbritary types, e.g. "neg(hostname)" would allow "!example.com" --- libs/web/luasrc/cbi/datatypes.lua | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'libs/web/luasrc/cbi') diff --git a/libs/web/luasrc/cbi/datatypes.lua b/libs/web/luasrc/cbi/datatypes.lua index 6640db6392..fc3048e37e 100644 --- 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 -- cgit v1.2.3