[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Escaped newlines with %q format specifier
- From: Paige DePol <lual@...>
- Date: Wed, 2 Jul 2014 12:45:44 -0500
On Jul 2, 2014, at 12:18 PM, Paige DePol <email@example.com> wrote:
> I am then left wondering what the escaped literal newline is used for? When quoting strings why wouldn't we want a newline to show up as '\n' instead of a backslash and a literal newline character? As this is existing functionality I will not change it, though I still wonder what it is used for, or if it something that is actually needed?
Guess I should of thought of this issue for longer before posting...
It is used for creating multi-line strings without using the [[ ... ]] syntax:
Lua 5.3.0 (work3) Copyright (C) 1994-2014 Lua.org, PUC-Rio
> longstring = "this is a \
>> long string with \
>> escaped newlines"
this is a
long string with
Though, to be honest, my expectation of creating a string in this fashion would of been to have a single string without newlines, just "this is a long string with escaped newlines".
Ah well, sorry for the noise! :)