Re: [5.1.4/newbie] "attempt to index ... 'file' (a nil value)"?
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: [5.1.4/newbie] "attempt to index ... 'file' (a nil value)"?
- From: Roberto Ierusalimschy <roberto@...>
- Date: 2011年2月18日 15:01:52 -0200
> > local file = io.open ('/var/tmp/myfile.txt',w)
>
> The file does not exist and you have opened if for reading.
>
> Try
> local file = io.open ('/var/tmp/myfile.txt',"w")
Better yet:
local file = assert(io.open ('/var/tmp/myfile.txt',"w"))
-- Roberto