lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



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.