lua-users home
lua-l archive

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


How does Lua parse newlines? For example:

print(#load('return "\\\r\n"')()) --> 1
print(#load('return "\\\n\r"')()) --> 1
print(#load('return "\\\r"')()) --> 1
print(#load('return "\\\n"')()) --> 1

print(load('return "\\z\r\n\\x"', "@[needed so results display correctly]")) --> nil, error line at 2 print(load('return "\\z\n\r\\x"', "@[needed so results display correctly]")) --> nil, error line at 2 print(load('return "\\z\n\\x"', "@[needed so results display correctly]")) --> nil, error line at 2 print(load('return "\\z\r\\x"', "@[needed so results display correctly]")) --> nil, error line at 2

So it seems that any of "\n", "\r", "\r\n" and "\n\r" are valid newlines. But where in the code is it?

--
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.