projects
/
project
/
luci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
89764da
)
libs/cbi: Fixed MultiValues
author
Steven Barth
<steven@midlink.org>
Mon, 14 Jul 2008 17:37:37 +0000
(17:37 +0000)
committer
Steven Barth
<steven@midlink.org>
Mon, 14 Jul 2008 17:37:37 +0000
(17:37 +0000)
libs/cbi/luasrc/cbi.lua
patch
|
blob
|
history
diff --git
a/libs/cbi/luasrc/cbi.lua
b/libs/cbi/luasrc/cbi.lua
index
2e788be
..
6e08455
100644
(file)
--- 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)
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
if luci.util.contains(self.keylist, value) then
- result = result
.. self.delimiter ..
value
+ result = result
and (result .. self.delimiter .. value) or
value
end
end
end
end
- if result:len() > 0 then
- return result:sub(self.delimiter:len() + 1)
- else
- return nil
- end
+ return result
end
end