lua-users home
lua-l archive

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


Mike Pall wrote:
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.

If I understand correctly Roberto's message in 2005/05/19 (No nesting in 5.1w6), you can use a compiler-time constant to allow backward compatibility on the above case:

##
The LUA_COMPAT_LSTR=2 is only for compatibility, so it allows nesting
only for the simple case [[...]] (without equal signs).
##

I think, unless you are doing a project from scratch and disconnected from the rest of the world, that Lua should be compiled with this option, which probably doesn't harm anything.

At least, a Lua lexer/parser should still handle this kind of nesting, to handle legacy code.

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --