From 3a0905f21cb1afe307402cb8ea1d89096f28c141 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Fri, 16 Dec 2011 05:52:24 +0000 Subject: libs/web: add list(...) datatype for space separated lists of arbritary datatypes --- libs/web/luasrc/cbi/datatypes.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'libs/web/luasrc') diff --git a/libs/web/luasrc/cbi/datatypes.lua b/libs/web/luasrc/cbi/datatypes.lua index 93b29cba81..9a3b735008 100644 --- a/libs/web/luasrc/cbi/datatypes.lua +++ b/libs/web/luasrc/cbi/datatypes.lua @@ -282,3 +282,17 @@ function neg(val, what) return false end + +function list(val, what, ...) + if type(val) == "string" and what and type(_M[what]) == "function" then + for val in val:gmatch("%S+") do + if not _M[what](val, ...) then + return false + end + end + + return true + end + + return false +end -- cgit v1.2.3