lua-users home
lua-l archive

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


On Jul 2, 2014, at 12:18 PM, Paige DePol <lual@serfnet.org> 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"
> 
> print(longstring)
this is a 
long string with 
escaped newlines

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! :)

~pmd