f:write

Writes to a file

Prototype

f:write (v1, v2, v3, ...)

Description

Writes arguments to the file. They must be strings or numbers.

f:write ("hi there", 42, "some more data") 
If the write was successful the function returns true.

If the file cannot be written the function returns 3 things: A sensible thing to do would be to check the return code like this:

assert (f:write ("hi there", 42, "some more data"))

Lua functions

Topics