mirror of
https://github.com/1bardesign/batteries.git
synced 2024-11-26 15:44:35 +00:00
[added] quoted strings in tablex.stringify; todo consider moving it to stringx actually, as it works for non-table types, maybe as stringx.pretty...
This commit is contained in:
parent
f6a2c9834f
commit
6bf6113dc2
@ -276,7 +276,12 @@ function tablex.stringify(t)
|
|||||||
--just use tostring
|
--just use tostring
|
||||||
local mt = getmetatable(t)
|
local mt = getmetatable(t)
|
||||||
if type(t) ~= "table" or mt and mt.__tostring then
|
if type(t) ~= "table" or mt and mt.__tostring then
|
||||||
return tostring(t)
|
local s = tostring(t)
|
||||||
|
--quote strings
|
||||||
|
if type(t) == "string" then
|
||||||
|
s = '"' .. s .. '"'
|
||||||
|
end
|
||||||
|
return s
|
||||||
end
|
end
|
||||||
|
|
||||||
--otherwise, collate into member chunks
|
--otherwise, collate into member chunks
|
||||||
|
Loading…
Reference in New Issue
Block a user