[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Bug?
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Tue, 29 Feb 2000 22:26:34 -0300 (EST)
>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