Here Doc

lua-users home
wiki

It could be nice if we could use heredocs[1] in Lua. Well, it is already there but with a fixed delimiter "[[" and "]]"[2].

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]] ]]

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

Solution: a = [=[ [a, [b, c]] ]=]

See Also


RecentChanges · preferences
edit · history
Last edited October 18, 2008 10:24 pm GMT (diff)