[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Writing to a file.
- From: Philippe Lhoste <PhiLho@...>
- Date: Tue, 15 Oct 2002 08:40:56 +0000 (UTC)
On mar. 15 oct. 2002 10:01:07, Basile STARYNKEVITCH
> As others I suggest switching to Lua4 at least.
> But when writing files (and this is true in many languages) you need
> to either flush or close them to have something in the file system.
Ouch, silly me, I didn't notice this culprit and instead of
copying/pasting the actual code, I rewrote it quickly, my way:
f = openfile("FooBar.txt", "w")
which works, of course, and do print "userdata(0): 00000000".
In Lua 4.0, "Unless otherwise stated, all I/O functions return nil on
failure and some value different from nil on success." and this "some
value" is actually an empty userdata.
In Lua 5.0, we get "true"...
Welcome to the wonderful world of Lua, Gaurav, I hope you will enjoy your
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist