diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2010-12-03 12:41:12 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2010-12-03 12:41:12 +0000 |
commit | 2a0903bc5018fe17fab8abaac6d24acfa382c869 (patch) | |
tree | 0d9bb780f5579549fbf9f74db06747bb7de38d7b /libs/web/luasrc | |
parent | 02ad68a4062b336c962513d3e75aeca7a5348dbb (diff) |
libs/web: fix dynamic list handling
Diffstat (limited to 'libs/web/luasrc')
-rw-r--r-- | libs/web/luasrc/cbi.lua | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/libs/web/luasrc/cbi.lua b/libs/web/luasrc/cbi.lua index ce995803d..6934be690 100644 --- a/libs/web/luasrc/cbi.lua +++ b/libs/web/luasrc/cbi.lua @@ -1346,7 +1346,7 @@ function AbstractValue.cfgvalue(self, section) return value[1] end elseif self.cast == "table" then - return luci.util.split(value, "%s+", nil, true) + return { value } end end @@ -1660,11 +1660,6 @@ function DynamicList.write(self, section, value) t[#t+1] = x 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 @@ -1699,12 +1694,16 @@ function DynamicList.formvalue(self, section) local value = AbstractValue.formvalue(self, section) if type(value) == "string" then - local x - local t = { } - for x in value:gmatch("%S+") do - t[#t+1] = x + if self.cast == "string" then + local x + local t = { } + for x in value:gmatch("%S+") do + t[#t+1] = x + end + value = t + else + value = { value } end - value = t end return value |