[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: string.format(%q) and escape sequences
- From: Dirk Laurie <dirk.laurie@...>
- Date: Tue, 13 Aug 2013 18:39:28 +0200
2013/8/13 Bernd Eggink <monoped@sudrala.de>:
> The documentation says, "the q option formats a string between double
> quotes, using escape sequences when necessary to ensure that it can safely
> be read back by the Lua interpreter".
> However, this is not true if the string contains certain escape sequences,
> such as \027 or \013:
>
> t="\027[1maha\027[m"
> t1=string.format("%q", t) --> "\27[1maha\27[m"
>
> On an xterm in Linux print(t) prints a nice bold aha, while print(t1)
> prints "\27[1maha\27[m". Is that a bug or am I missing something?
"Escape sequence" for an xterm means something different: the term refers
to formatting instructions to the renderer. In the sense of the
manual, it refers
to a sequence that are used to encode (sepecially) control characters.