News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.


Post Reply  Post Thread 
io.write() vs. my_output:write()
Author Message
mikshaw
Senior Member
****


Posts: 522
Group: Registered
Joined: Apr 2007
Status: Offline
Reputation: 5
Post: #1
Question  io.write() vs. my_output:write()

I wonder if someone could help me understand when to choose one over the other.
Consider the following:

Code:
my_output=io.open("filename.txt","w+")
if my_output then my_output:write("some stuff")
my_output:close()
end


Code:
io.output("filename.txt")
io.write("some stuff")
io.output()


Both apparently have a similar result, although with io.write() there doesn't seem to be a way to prevent a fatal error when the file can't be written.

07-15-2007 04:19 AM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Messages In This Thread
io.write() vs. my_output:write() - mikshaw - 07-15-2007 04:19 AM

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: