lua-users home
lua-l archive

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


Alex Davies wrote:
> Imagine reading the output of an escaped 100kB text file
> otherwise.

I guess I don't consider that a use case for s:format("%q") but rather a
use case for io.write('[[' .. s .. ']]'). The former only seems useful
when I want to write a short string that is quoted for later reading.

Doug

> ----- Original Message ----- From: "Doug Rogers" <rogers@innocon.com>
>> It seems like using "\n" would give an exact representation of the
>> string even if it is written to a file that is shared between machines
>> with different line termination characteristics. My experience with this
>> sort of thing is that there was a reason for it, but the only reason I
>> can come up with (allowing multi-line quoted strings) is easily
>> dismissed by using '[['.
>>
>> Is it done this way explicitly so it can automatically pick up the
>> LF/CR+LF of the host system when the string is re-read?


-- 
Innovative Concepts, Inc. www.innocon.com 703-893-2007 x220