[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Free format strings?
- From: Björn De Meyer <bjorn.demeyer@...>
- Date: Tue, 24 Dec 2002 16:01:33 +0100
Peter Hill wrote:
> In Lua we have both:
> which produce the same effect.
> However there doesn't seem to be a way to wrap long strings *without*
> inserting a newline. Tradionally, "\" by itself has been used as a
> free-format wrap character for strings. So:
> was the same as
> Does Lua have such a feature? If not it should.
> Peter Hill.
The way you do it in Lua is simply to say
Yes, its' a concatenation, but string
concatenation in Lua is a VM primitive,
so it's not that inefficient.
If you must have the behaviour you propose,
then edit llex.c, find the function
static void read_string (LexState *LS, int del, SemInfo *seminfo)
And change line number 278:
case '\n': save(LS, '\n', l); inclinenumber(LS); break;
case '\n': inclinenumber(LS); break;
That way, no newline character is stored.
You'll also need to modify the string.format()
function, though for that assumes \<newline>
stores a newline in the string.
"No one knows true heroes, for they speak not of their greatness." --
Björn De Meyer