summaryrefslogtreecommitdiffhomepage
path: root/libs
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-07-14 17:37:37 +0000
committerSteven Barth <steven@midlink.org>2008-07-14 17:37:37 +0000
commitd12dfa5186f83fdb25ddbadfe2077f40115ce820 (patch)
tree55f851a1d1ea4ed6b047bbb11cb397db5b1d4e79 /libs
parent89764da3687815bc8e3d2d540ccd5329b5e351c9 (diff)
libs/cbi: Fixed MultiValues
Diffstat (limited to 'libs')
-rw-r--r--libs/cbi/luasrc/cbi.lua16
1 files changed, 5 insertions, 11 deletions
diff --git a/libs/cbi/luasrc/cbi.lua b/libs/cbi/luasrc/cbi.lua
index 2e788be5f..6e0845565 100644
--- a/libs/cbi/luasrc/cbi.lua
+++ b/libs/cbi/luasrc/cbi.lua
@@ -729,21 +729,15 @@ function MultiValue.valuelist(self, section)
end
function MultiValue.validate(self, val)
- if not(type(val) == "string") then
- return nil
- end
+ val = (type(val) == "table") and val or {val}
- local result = ""
+ local result
- for value in val:gmatch("[^\n]+") do
+ for i, value in ipairs(val) do
if luci.util.contains(self.keylist, value) then
- result = result .. self.delimiter .. value
+ result = result and (result .. self.delimiter .. value) or value
end
end
- if result:len() > 0 then
- return result:sub(self.delimiter:len() + 1)
- else
- return nil
- end
+ return result
end