diff options
-rw-r--r-- | apt-panopticommon.lua | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/apt-panopticommon.lua b/apt-panopticommon.lua index 99dbeaf..42da301 100644 --- a/apt-panopticommon.lua +++ b/apt-panopticommon.lua | |||
@@ -250,7 +250,22 @@ dumpTableSub = function (table, space) | |||
250 | if type(v) == "table" then | 250 | if type(v) == "table" then |
251 | r = r .. APT.dumpTable(v, space, k) | 251 | r = r .. APT.dumpTable(v, space, k) |
252 | elseif type(v) == "string" then | 252 | elseif type(v) == "string" then |
253 | r = r .. space .. "[" .. k .. "] = '" .. v .. "';\n" | 253 | local bq = '"' |
254 | local eq = '"' | ||
255 | if nil ~= v:match(bq) then | ||
256 | bq, eq = '"', '"' | ||
257 | if nil ~= v:match(bq) then | ||
258 | bq, eq = '[[', ']]' | ||
259 | mbq, meq = '%[%[', '%]%]' | ||
260 | while (nil ~= v:match(mbq)) or (nil ~= v:match(meq)) do | ||
261 | bq = '[' .. '=' .. bq:sub(2, -1) | ||
262 | eq = ']' .. '=' .. eq:sub(2, -1) | ||
263 | mbq = '%[' .. '=' .. bq:sub(3, -1) | ||
264 | meq = '%]' .. '=' .. eq:sub(3, -1) | ||
265 | end | ||
266 | end | ||
267 | end | ||
268 | r = r .. space .. "[" .. k .. "] = " .. bq .. v .. eq .. ";\n" | ||
254 | elseif type(v) == "function" then | 269 | elseif type(v) == "function" then |
255 | r = r .. space .. "[" .. k .. "] = function ();\n" | 270 | r = r .. space .. "[" .. k .. "] = function ();\n" |
256 | elseif type(v) == "userdata" then | 271 | elseif type(v) == "userdata" then |