lua-users home
lua-l archive

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


Enrico Colombini wrote:
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).

Your other option is to use some type of markup and do post processing on the strings. A simple implementation might treat a blank line as a paragraph break, otherwise converting any run of newlines and spaces into a single space. However, implementing something slightly more complex like a few HTML tags might provide advantages, such as the ability to specify bold/italic.

-John



--
http:// i      .   /