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
Junior Member

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

io.write is really io.stdout:write

Using io.output you are really redirecting stdout.

When used with an argument it becomes the new default output and as such is opened in the "w" mode, i.e, to overwrite if it exists, or to create if it does not exist..

Changing the default output can be risky when you don't have permission, as you have noted. But can be useful in a quick and dirty sort of way.

Usually, I use the full file handle method as in your first example. This provides better control over error conditions.

07-15-2007 02:58 PM
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
RE: io.write() vs. my_output:write() - roberts - 07-15-2007 02:58 PM

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

Forum Jump: