[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Literal string strangeness
- From: Jim Whitehead II <jnwhiteh@...>
- Date: Fri, 23 Oct 2009 12:27:47 +0100
On Fri, Oct 23, 2009 at 12:21 PM, Matthew Wild <mwild1@gmail.com> wrote:
>
> 2009/10/23 Dirk Feytons <dirk.feytons@gmail.com>:
> > On Fri, Oct 23, 2009 at 12:51 PM, Mauro Iazzi <mauro.iazzi@gmail.com> wrote:
> >>> I would have expected a 13 in place of the second 10. Any ideas?
> >>> I am using Lua 5.1.4 on linux. Thanx!
> >>
> >> It is deliberate, see llex.c lines 257-263. I cannot find any mention
> >> in the manual ( assuming it would be in
> >> http://www.lua.org/manual/5.1/manual.html#2.1)
> >
> > It is mentioned there: "For convenience, when the opening long bracket
> > is immediately followed by a newline, the newline is not included in
> > the string."
> >
>
> No, this is different. It is to do with Lua's "handling" of CRLF line
> endings I believe. I feel this is wrong in strings, especially long
> strings, and have been hit by it before (fair enough, I /was/ trying
> to embed binary data inside a script).
The correct passage from the refman:
Literals in this bracketed form can run for several lines, do not
interpret any escape sequences, and ignore long brackets of any other
level.
- Jim