lua-users home
lua-l archive

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

On Wed, Aug 31, 2016 at 10:38 AM, Soni L. <> wrote:
In Lua, you can't put a line break in the middle of a string. However, ever since Lua 5.2, newlines are equivalent to whitespace everywhere else.

This is incorrect. Newlines are not equivalent to whitespace *in strings*. Whitespace is significant *in strings*.

This is a feature, not a bug.

$ lua
Lua 5.3.3  Copyright (C) 1994-2016, PUC-Rio
> "test
>> test"
stdin:1: unfinished string near '"test'


$ lua
Lua 5.3.3  Copyright (C) 1994-2016, PUC-Rio
> do
>> print("x")
>> (print)("test")
>> end
stdin:2: attempt to call a nil value
stack traceback:
    stdin:2: in main chunk
    [C]: in ?

Note that I'm asking for multiline strings that support escapes, not the removal of raw strings.

(I'm fine with line comments the way they are, tho)

Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.