lua-users home
lua-l archive

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


>From lua-l@tecgraf.puc-rio.br  Tue Feb 29 21:43:12 2000
>From: "Ashley Fryer" <lua@bmarket.com>
>
>Under 3.1, from the lua console:
>
>dostring("print('\\b')")
>
>Expected output:
>\b
>
>Actual output:
>[unprintable, ascii 8, backspace]
>
>Can someone confirm whether or not this is a bug, and if it's still present
>in later versions?

No, this is not a bug.
When dostring("print('\\b')") is parsed, the compiler sees a string
"print('\\b')", in which it then recognizes the escape sequence \\ and replaced
by the char \. So, the string is actually print('\b'). When this is parsed again
when dostring is executed, then \b is recognized as backspace, which is ascii 8.

To print \b (two-char string), you need to use
	dostring("print('\\\\b')")

--lhf