# love.filesystem.write

Write data to a file in the save directory. If the file existed already, it will be completely replaced by the new contents.

## Function

### Synopsis

    success = love.filesystem.write( name, data, size )

### Arguments

`string name`
  The name (and path) of the file.
`string data`
  The string data to write to the file.
`number size (all)`
  How many bytes to write.

### Returns

`boolean success`
  If the operation was successful.

## Function

### Synopsis

    success = love.filesystem.write( name, data, size )

### Arguments

`string name`
  The name (and path) of the file.
`Data data`
  The Data object to write to the file.
`number size (all)`
  How many bytes to write.

### Returns

`boolean success`
  If the operation was successful.

## Notes

If you are getting the error message "Could not set write directory", try setting the save directory. This is done either with love.filesystem.setIdentity or by setting the identity field in love.conf.

Writing to multiple lines: In Windows, some text editors (e.g. Notepad) only treat CRLF ("\r\n") as a new line.

## See Also

- love.filesystem
- love.filesystem.append

##

Category:

- Functions