lua-users home
lua-l archive

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


"Patrick Donnelly" <batrick.donnelly@gmail.com> writes:
> a = "a piece of a string
>        "another piece
>        "the end";
>
> It's completely backwards compatible with core Lua now as far as I can
> tell.

I think having intentionally mis-matched quotes is likely to cause
confusion though (both for readers and syntax-aware editors)...

Is it possible to define new \ escapes in Lua?  Perhaps there could be
some new \ escape which is sort of like \-newline, except that it would
ignore any following (source) whitespace (including the newline)?  Say,
for instance, "\*"; then one could write:

   a = "a piece of a string\*
        another piece\*
        the end";

Maybe not the prettiest, but not too bad, and a bit more conventional
looking to help the readers (and syntax-aware editors).

[The reason why I said "(source) whitespace" is so that in case one
wanted to include some whitespace at the beginning of lines, one could
write something like:

   a = "line1\n\*
       \    line2\n*
       \    line3";
]

-Miles

-- 
Abstainer, n. A weak person who yields to the temptation of denying himself a
pleasure. A total abstainer is one who abstains from everything but
abstention, and especially from inactivity in the affairs of others.