lua-users home
lua-l archive

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


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.