lua-users home
lua-l archive

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




On 2017-10-14 12:34 PM, Soni L. wrote:
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?


Quick update:

> print(load('return "\\z \n\r \n\r \r\n \n \n\\x"', "@test"))
nil    test:6: hexadecimal digit expected near '"\x"

WHY LINE 6. I NEED TO KNOW.

--
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.