[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: comparing Lua with other languages
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 29 Dec 2004 15:04:26 -0200
Wouldn't be easier to use the "simple I/O model"?
- local infile, err = io.open(arg[1], "r")
- if not infile then
- io.stderr:write(err, "\n")
- return
- end
+ io.input(arg[1])
- outfile, err = io.open(arg[2], "w")
- if not outfile then
- infile:close()
- io.stderr:write(err, "\n")
- return
- end
+ io.output(arg[2])
- (outfile or io.stdout):write(line, "\n")
+ io.write(line, "\n")
(etc.)
-- Roberto