libs/web: better server side handling of DynList values
This commit is contained in:
parent
d79895c0c3
commit
be385bfcc6
1 changed files with 18 additions and 6 deletions
|
@ -1657,15 +1657,27 @@ function DynamicList.value(self, key, val)
|
||||||
end
|
end
|
||||||
|
|
||||||
function DynamicList.write(self, section, value)
|
function DynamicList.write(self, section, value)
|
||||||
if self.cast == "string" and type(value) == "table" then
|
local t = { }
|
||||||
value = table.concat(value, " ")
|
|
||||||
elseif self.cast == "table" and type(value) == "string" then
|
if type(value) == "table" then
|
||||||
local x, t = { }
|
local x
|
||||||
for x in value:gmatch("%S+") do
|
for _, x in ipairs(value) do
|
||||||
if #x > 0 then
|
if x and #x > 0 then
|
||||||
t[#t+1] = x
|
t[#t+1] = x
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
elseif self.cast == "table" then
|
||||||
|
local x
|
||||||
|
for x in util.imatch(value) do
|
||||||
|
t[#t+1] = x
|
||||||
|
end
|
||||||
|
else
|
||||||
|
t = { value }
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.cast == "string" then
|
||||||
|
value = table.concat(t, " ")
|
||||||
|
else
|
||||||
value = t
|
value = t
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue