lua-users home
lua-l archive

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


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