lua-users home
lua-l archive

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


'\n' works for me also, or is it a Linux-only exception?

Blessings!

On Mon, Oct 12, 2009 at 8:35 AM, Ico <lua@zevv.nl> wrote:


* On 2009-10-12 Rob Kendrick <lua-l@nun.org.uk> wrote  :

> On Mon, 12 Oct 2009 08:17:45 -0500
> Fernando P. García <fernando@develcuy.com> wrote:
>
> > In most languages (not only scripting) the use of single quotes is
> > faster than double quotes, does it is applicable in Lua? perhaps for
> > the other ways define strings?
>
> In some languages, string interpolation happens with one style of
> quotes, but not the others.  Lua does no form of string interpolation
> on literals; all three types of string delimiters are compiled to
> identical byte code; there is no performance penalty for favouring one
> over the other.

There is a difference: in double quotes escape sequences are
translated. So

 a = "one\ntwo"

gives a differnet result then

 a = 'one\ntwo'


--
:wq
^X^Cy^K^X^C^C^C^C



--
Fernando P. García, http://www.develcuy.com
Developer - Analista de Sistemas
+51 1 9 8991 7871, Calle Santa Catalina Ancha #377, Cusco -Perú

** Antes de imprimir este mensaje piensa en tu compromiso con el medio ambiente, protegerlo depende de tí.