lua-users home
lua-l archive

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

On mar. 15 oct. 2002 10:01:07, Basile STARYNKEVITCH 
<> wrote:

> 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")
print(write(f, "Doh!"))

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 
stay :-)

Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist