lua-users home
lua-l archive

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


Hi Thijs,
though Lua novice, I think this is quite typical problem with text
file, which you really unfortunately have in ANY programming language
/ programming application.

How should "poor Lua" know, whether you are running it on a Windows
(by MS standard using \r\n)  or a Linux system (by standard using \n).

In this same problem you also run, if you use hyperterminal or
teraterm or other programs for serial communications: Some of these
programs will use either the one line end "by standard", and others
the other... .

In my IoT Lua for controllers, I made it like this, that I generally
require \n for line end. If then last char is \r, I will also "kill
this automatically"... but I am NOT sure whether this is "fail proof"
/ at least not in "big system Windows/Linux world" ... possibly some
people would have files with "mixed line end" due to some reasons and
then would prefer to recognize this somehow / handle the \r separately
in Lua.

... on of the "nerving inventions of MS" I always thought ... but if
Mac has the same problem ...  :(.

Another clearly "nerfing invetions of MS" concerning text files, is
the "regional settings dependency" of CSV column / number formatting
(list delimiter char and decimal sep char...).

On Thu, Mar 24, 2022 at 2:51 PM Thijs Schreijer <thijs@thijsschreijer.nl> wrote:
>
>