lua-users home
lua-l archive

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


Hi,

Klaas-Jan Stol wrote:
> >>- Long strings and comments cannot be nested in 5.1.
> >
> So, just to make sure (before I start implementing the whole thing), you 
> can't do:
> 
> [=[I said: [==[Hello World]==] to him]=]

No, I was imprecise. Sorry. My above sentence should be:

  Long strings and comments --> with the same number of '=' <--
  cannot be nested in 5.1.

As a corollary, this makes [[xx[[xx]]xx]] a syntax error
(was legal in 5.0). Different number of '=' nest properly.

$ lua51w6 -e 'print [=[I said: [==[Hello World]==] to him]=]'
I said: [==[Hello World]==] to him

$ lua51w6 -e 'print [=[I said: [[Hello World]] to him]=]'
I said: [[Hello World]] to him

$ lua51w6 -e 'print [==[I said: [==[Hello World]==] to him]==]'
lua51w6: (command line):1: '=' expected near 'him'

$ lua51w6 -e 'print [[I said: [[Hello World]] to him]]'
lua51w6: (command line):1: nesting of [[...]] is deprecated near '['

Bye,
     Mike