[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Bug: Literal strings in long format are not quite literal.
- From: Jim Studt <jim@...>
- Date: Fri, 2 Nov 2012 09:46:24 -0500
In Lua 5.1.5, and from looking at the source, it appears 5.2, a literal string in long format will drop a carriage return when followed by a linefeed.
The manual suggests they should not do this...
"Literals in this bracketed form can run for several lines, do not interpret any escape sequences,
and ignore long brackets of any other level. They can contain anything except a closing bracket
of the proper level."
You can see it happen in this test program, which unfortunately you have to make yourself because it has to contain literal carriage return characters. The "^M" sequences represent carriage return characters, in emacs you can insert them with C-q C-m.
print( #[=[A^MB]=])
print( #[=[A^M
B]=])
When run, you will see that both strings have a length of 3, where the second one should actually be 4. The carriage return gets dropped and only the newline passes to the string.