[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Backslash-newline escape as a line continuation rather than a newline?
- From: Jonathan Castello <twisolar@...>
- Date: Fri, 2 Apr 2010 18:47:16 -0700
On Fri, Apr 2, 2010 at 6:41 PM, M Joonas Pihlaja
<jpihlaja@cc.helsinki.fi> wrote:
>
> Hey,
>
> In Lua 5.2 string literals could the backslash-newline escape code
> swallow the newline character rather than embedding it into the
> string? This would be similar to C's continuation lines.
>
> The motivation for me is that there doesn't seem to be a way of having
> really long string literals in a Lua source file split across multiple
> lines without extra runtime overhead. As far as I can tell, I either
> have to use shorter pieces and concatenate them at runtime, or add
> extra newlines to the string and remove them at runtime.
>
> Cheers,
>
> Joonas
>
Is there a reason you can't use the [[multiline string]] syntax?
----
mylongstring = [[Foo bar baz
foo bar
baz
test test test]]
print(mylongstring)
----
~Jonathan