lua-users home
lua-l archive

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


On Thu, Jan 28, 2016 at 10:34 PM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> I'm developing a Lua program under Linux that may in some
> not totally unforeseeable future need to run under Windows.
>
> Do line endings get standardized when Lua reads a text file?
>
> More precisely, in the following code snippet, will "line"
> contain "\r" characters?
>
> infile = io.open"filename.txt"
> source = infile:read"*a"
> for line in source:gmatch"[^\n]+" do
>    -- whatever
> end

I don't know the answer to that question, Dirk, but my understanding
is that "\r" is unnecessary on any of Linux/Unix, Windows, or the
recent releases of OS X. I write and share lots of multi-OS scripts
for NoteCase Pro and stopped including the carriage return token years
ago without any subsequent complaint from any users (regarding the
missing "\r").

As I understand the situation, only the early versions of OS X that
ran on a RISC processor wanted the "\r" and Apple did away with that
when they rebuilt OS X on Unix.

Best regards,

Paul

-- 
[Notice not included in the above original message:  The U.S. National
Security Agency neither confirms nor denies that it intercepted this
message.]