lua-users home
lua-l archive

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


It was thus said that the Great M Joonas Pihlaja once stated:
> 
> On Fri, 2 Apr 2010, Jonathan Castello wrote:
> 
> > Is there a reason you can't use the [[multiline string]] syntax?
> 
> Yes.  The string contains newlines only sporadically.  Multiline 
> string syntax embeds newlines in the string, except for the first one 
> right after the opening [[.  I'd have to escape the newlines which
> are there, introduce new ones at regular intervals, and then at
> runtime remove the new ones and unescape the original ones.  This 
> solution is unpleasant.

  The multiline string contains newlines exactly where you put them, so why
can't you do something like:

reallylongstring = [[

blank line above
new line is here and there is a blank line below me

but this line isn't blank

]]

> As for concatenation, I get the error "chunk has too many syntax 
> levels" if I try to use concatenation like this: "foo".."bar".. <...> 
> "baz", after a few hundred strings.  The solution table.concat{ "foo", 
> "bar", <...>, "baz"} does work, but I would rather not import millions 
> of small strings when I could import just the one huge one once.

  Perhaps if you were to give an example of what you are trying to achieve,
we can help you more.

  -spc