lua-users home
lua-l archive

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


At 13.30 05/10/02 +0200, Björn De Meyer wrote:
>What's wrong with a long string between [[ ]] ?

Suppose I want to write:

function Flame()
  if some_condition then
    say[[
      you are in a vast room whose other end is lost
      in the distance;\n the room is crammed full of 
      Lua programmers hotly debating a minor issue.\n
      Most on them have small dragons on long leashes, 
      whose fiery breath is scorching all that seem to
      disagree with their master.
      ...and so on and so on for an awful lot of lines...
    ]]
    other_code_here
  end
end

I see two problems here:
- first, newlines are inserted in the string. I can't tell them
  from those I inserted as '\n'.
- second, if I indent my text for better reading, spaces are 
  added at the beginning of each line.

I could either use kilometric lines (most editors don't like them, and
readability goes down the drain), or concentenate the lines with '..'
(which would be acceptable if the parser could read them as a single string).

>As for the answer to your other question, it turned out to be a problem
>with the C library on some systems. Please read Edgar Toernig's mails.

Didn't he refer to Lua 5.0? I am still planning to use 4.0, and I already
encountered the slow concatenation problem in another application (saving a
large and complex table to a string took minutes).

  Enrico