diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2011-12-16 05:52:24 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2011-12-16 05:52:24 +0000 |
commit | 3a0905f21cb1afe307402cb8ea1d89096f28c141 (patch) | |
tree | 051bf3027671eba27184035f916466d9537cf022 /libs/web/luasrc/cbi | |
parent | ca7bc48ebc0b1f655088eaae89bd358556dc8824 (diff) |
libs/web: add list(...) datatype for space separated lists of arbritary datatypes
Diffstat (limited to 'libs/web/luasrc/cbi')
-rw-r--r-- | libs/web/luasrc/cbi/datatypes.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libs/web/luasrc/cbi/datatypes.lua b/libs/web/luasrc/cbi/datatypes.lua index 93b29cba8..9a3b73500 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 |