]> git.lizzy.rs Git - metalua.git/commitdiff
better rendering of strings by table.tostring() and table.print()
authorunknown <Fabien@.(none)>
Wed, 17 Dec 2008 10:00:22 +0000 (11:00 +0100)
committerunknown <Fabien@.(none)>
Wed, 17 Dec 2008 10:00:22 +0000 (11:00 +0100)
src/lib/metalua/table2.lua

index c321282673e309c8ac1892ae46ce281eb21c1b8a..b4962cac1c0b09d434e5a96890808e67ca4a50da 100644 (file)
@@ -279,7 +279,8 @@ function table.tostring(t, ...)
       local x = { }
       x["nil"] = function() acc "nil" end
       function x.number()   acc (tostring (adt)) end
-      function x.string()   acc (string.format ("%q", adt)) end
+      --function x.string()   acc (string.format ("%q", adt)) end
+      function x.string()   acc ((string.format ("%q", adt):gsub("\\\n", "\\n"))) end
       function x.boolean()  acc (adt and "true" or "false") end
       function x.table()
          if nested[adt] then acc(tostring(adt)); return end