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:
b3d6325
)
* luci/libs: util: improve table handling and support mixed tables in serialize_data()
author
Jo-Philipp Wich
<jow@openwrt.org>
Thu, 28 Aug 2008 16:17:42 +0000
(16:17 +0000)
committer
Jo-Philipp Wich
<jow@openwrt.org>
Thu, 28 Aug 2008 16:17:42 +0000
(16:17 +0000)
libs/core/luasrc/util.lua
patch
|
blob
|
history
diff --git
a/libs/core/luasrc/util.lua
b/libs/core/luasrc/util.lua
index 2ede71a264502c1ad6572efdf8a6821853901adc..2a7e70453f861a8e720c500d0d1121f063df10e6 100644
(file)
--- a/
libs/core/luasrc/util.lua
+++ b/
libs/core/luasrc/util.lua
@@
-437,11
+437,17
@@
function _serialize_table(t, seen)
seen[t] = true
local data = ""
seen[t] = true
local data = ""
+ for i = 1, #t do
+ local v = serialize_data(t[i], seen)
+ data = data .. ( #data > 0 and ", " or "" ) .. v
+ end
for k, v in pairs(t) do
for k, v in pairs(t) do
- k = serialize_data(k, seen)
- v = serialize_data(v, seen)
- data = data .. ( #data > 0 and ", " or "" ) ..
- '[' .. k .. '] = ' .. v
+ if type(k) ~= "number" then
+ k = serialize_data(k, seen)
+ v = serialize_data(v, seen)
+ data = data .. ( #data > 0 and ", " or "" ) ..
+ '[' .. k .. '] = ' .. v
+ end
end
return data
end
end
return data
end