[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: file:write() fails silently for read-only files
- From: startx <startx@...>
- Date: Tue, 6 Sep 2011 08:21:55 +0100
On Tue, 6 Sep 2011 01:12:07 -0600
HyperHacker <hyperhacker@gmail.com> wrote:
>> On Tue, Sep 6, 2011 at 01:10, startx <startx@plentyfact.org> wrote:
> > hm, when i do that ( on linux ) i _do_ get an error
> >
> > lua: filer.lua:2: attempt to index global 'f' (a nil value)
> > stack traceback:
> > filer.lua:2: in main chunk
> > [C]: ?
> >
> > startx
> >
> >
>
> You'd need to create a file "foo.foo" first...
>
yes, you are correct.
however, you do something like
f = io.open('foo.foo', 'r')
success = f:write('ffd')
f:close()
success will be NIL if the file cannot be written to.
one one hand i see your point that it could throw an error instead, but
then again ...
startx