io.write()

Type Function
Library io.*
Return value none
Revision Release 2024.3703
Keywords io, write, file
See also io.open()

Overview

Writes the value of each of its arguments to the file. The arguments must be strings or numbers. To write other values, use tostring() or string.format() before writing.

In the normal mode, this function writes to the standard output (stdout) which defaults to the Corona Simulator Console if io.output() has not been called with a file name. This is equivalent to io.output():write. In short, it's similar to print(), but no newline character (\n) is appended to the output string.

If you intend to write data to a file, file:write() should be used instead of io.write().

For security reasons, you are not allowed to write files in the system.ResourceDirectory (the directory where the application is stored). You must specify the system.DocumentsDirectory, system.ApplicationSupportDirectory, system.TemporaryDirectory, or system.cachesDirectory parameter in the system.pathForFile() function when opening the file for writing. See io.open() for details.

Syntax

io.write( arg1 [, arg2] [, ...] )
arg1, arg2, ... (optional)

String or Number. One or more string or number arguments (separate by commas).