loadscript file_io_test 
   -- Get the current date and time. 
   date_time = os.date("%c", os.time())   
   -- Open the three files for writing. 
   myfile1, myfile1_err, myfile1_errnum = io.open("/usb1/myfile_io1", "w") 
   myfile2, myfile2_err, myfile2_errnum  = io.open("/usb1/myfile_io2", "w") 
   myfile3, myfile3_err, myfile3_errnum  = io.open("/usb1/myfile_io3", "w") 
   if (io.type(myfile1) == "file") then 
         if (io.type(myfile2) == "file") then 
            if (io.type(myfile3) == "file") then 
               -- Make myfile1 the default output file. 
               io.output(myfile1)   
               -- Write some data to the default file. 
               io.write("Using io write to myfile1 to io output\n")  
               io.write(date_time)  
               io.write("\n")  
               -- Write to myfile2 using descriptor rather than io write command. 
               myfile2:write("    file handle to write to myfile2\n") 
               myfile2:write("    while myfile1 is output file for io\n") 
               -- Make myfile2 the default output file. 
               io.output(myfile2)   
               -- Write some data to the default file. 
               io.write("Using io write to myfile2 to io output\n")  
               io.write(date_time)  
               io.write("\n")  
               -- Write to myfile3 using descriptor rather than io write command. 
               myfile3:write("    file handle to write to myfile3\n") 
               myfile3:write("    while myfile2 is output file for io\n") 
               -- Make myfile3 the default output file. 
               io.output(myfile3)   
               -- Write some data to the default file. 
               io.write("Using io write to myfile3 to io output\n")  
               io.write(date_time)  
               io.write("\n")  
 
               -- Write to myfile1 using descriptor rather than io write command. 
               myfile1:write("    file handle to write to myfile1\n") 
               myfile1:write("    while myfile3 is output file for io\n") 
               -- Use the io close rather than file descriptor close command. 
               io.close(myfile1) 
               io.close(myfile2) 
               io.close(myfile3) 
 
         else 
               print("myfile3 did not open for write") 
               print("error string is " .. myfile3_err) 
               print("error number is " .. myfile3_errnum) 
         end 
      else 
         print("myfile2 did not open for write") 
         print("error string is " .. myfile2_err) 
         print("error number is " .. myfile2_errnum) 
      end