[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: file:write() fails silently for read-only files
- From: Lorenzo Donati <lorenzodonatibz@...>
- Date: Tue, 06 Sep 2011 20:41:46 +0200
On 06/09/2011 9.37, steve donovan wrote:
On Tue, Sep 6, 2011 at 9:21 AM, startx<firstname.lastname@example.org> wrote:
f = io.open('foo.foo', 'r')
success = f:write('ffd')
success will be NIL if the file cannot be written to.
Ah, but not always!
f = io.open('errio.lua')
for i = 1,3 do
On this machine (Windows XP) that write returns true - a silent error!
Must be Windows weirdness, because this script does behave as you
expect on Linux.
If errio.lua contains just two lines:
nil No error 0
I.e.: the "write" operation kindly informs me that there was no error!
:-) (the last 0 is another mistery).
I'm on WinXP sp2; Lua 5.1.4 and 5.2 beta produce the same result. They
were compiled with tdm-gcc 4.5.2.