lua-users home
lua-l archive

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

On Jan 18, 2008 6:45 PM, Roberto Ierusalimschy <> wrote:
> > Since the manual says that long strings "may contain anything except a
> > closing bracket of the proper level" and observing that even embedded
> > NUL characters are preserved, I expected embedded CRs to be as well,
> > which they are, except if they're followed by a LF. So, should I
> > interpret this that long strings may indeed contain anything other
> > than its closing bracket, but that CR-LF sequences, while allowed, are
> > lost? If so, perhaps this limitation should be stated in the manual?
> Perhaps the manual could be even more rigid, stating that only text
> should be used inside literal strings? Even if Lua accepts them, it
> does not seem a good idea to have control characters floating in
> a source file.

Perhaps, but then we're down to how to define "text", given different
encodings, etc., which is odd, given how Lua has historically
maintained itself agnostic in this matter. Recommend against using
byte values 0-9, 11-31 and 127? Works for ASCII, ISO-8859-* and UTF-8,
not sure about the rest. In any case, doesn't sound very good. :)
Practically speaking, a note warning that CR-LF sequences inside long
strings are converted to LF would suffice, if that's really the
intended behavior (even though I consider it unfortunate, myself).

-- Hisham