[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Function to improve on 'print(table)'
- From: PA <petite.abeille@...>
- Date: Sat, 1 Sep 2007 21:15:28 +0200
On Sep 01, 2007, at 21:05, Mason Deaver wrote:
http://dev.alt.textdrive.com/browser/HTTP/Data.lua
Works great, except the output is all on one line. I changed line
110, added a newline to the format string, so it looks like this:
aBuffer[ #aBuffer + 1 ] = ( '\n%s[%s]=%s' ):format( aName, aKey,
aValue )
Alternatively, you could change line 113 instead:
return table.concat( aBuffer, '\n' )
I find this output style helpful, especially with complex nested
tables.
This is also valid Lua code, so you can use it as a simple
serialization format.