Here Doc

lua-users home
wiki

Will be nice if we can use the heredoc capability, well it is already there but with a fixed delimiter "[[" and "]]" and the ability to make variables substitution inside strings like perl, tcl, ruby.

This change would make Lua harder to parse (for external parsers, too, which interest me. I think [[ ]] strings are just fine, personally. Remember that Lua does count [[ and ]] inside the strings, although as someone pointed out this fails in certain cases, like:

a = [[ [a, [b, c]] ]]

Variable substitution inside strings is a nightmare in the general case (and creates other parsing problems, as well as some ambiguity about the use of local variables). The syntax:

a = 'The value of x is"' ..x.. '".\n'

is really not that awkward, although I admit it's not quite so compact as Perl. But here's something which is quite compact: StringInterpolation

I would encourage people to try to figure out how to use the power and simplicity of Lua rather than trying to make it into some other language. --RiciLake

FindPage · RecentChanges · preferences
edit · history
Last edited August 26, 2006 3:30 am GMT (diff)