lua-users home
lua-l archive

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


2018-01-07 9:03 GMT+02:00 nobody <nobody+lua-list@afra-berlin.de>:
>> 2018-01-07 5:01 GMT+02:00 Soni "They/Them" L. <fakedme@gmail.com>:
>>>
>>>
>>> print("{\n\z
>>>      \x20   \"hello\": \"world\"\n\z
>>>      }")
>>>
> On 2018-01-07 07:48, Dirk Laurie wrote
>>
>> Isn't that just a tortuous way of coding something that Lua can do much
>> more conveniently?
>>
>> print [[{
>>      "hello": "world"
>> }]]
>
>
> Not if CR-LF must not be normalized (e.g. binary data or fixed format
> like HTTP / …). Then you're forced to use "normal" strings.

This sounds so reasonable that I almost believed it until I tried to
figure out what it means.

I suppose "normalize" has something to do with whether the actual
bytes emitted by "\n" are "\x0a" or "\x0d" or some combination thereof.
I do not see documented in the Lua manual whether the non-printing
newline in a long string is rendered differently from the escape
sequence "\n", but I will be vastly surprised if it is.