Difference between revisions of "love.filesystem.write"
(→Notes) |
(Added missing Data variant) |
||
Line 1: | Line 1: | ||
− | Write data to a file | + | Write data to a file in the save directory. If the file existed already, it will be completely replaced by the new contents. |
== Function == | == Function == | ||
=== Synopsis === | === Synopsis === | ||
Line 6: | Line 6: | ||
</source> | </source> | ||
=== Arguments === | === Arguments === | ||
− | {{param|string|name|The name (and path) of the file}} | + | {{param|string|name|The name (and path) of the file.}} |
− | {{param|string|data|The data | + | {{param|string|data|The string data to write to the file.}} |
− | {{param|number|size (all)|How many bytes to write}} | + | {{param|number|size (all)|How many bytes to write.}} |
=== Returns === | === Returns === | ||
− | {{param|boolean|success|If the operation was successful}} | + | {{param|boolean|success|If the operation was successful.}} |
− | |||
− | |||
− | '''Writing to multiple lines''': | + | == Function == |
+ | === Synopsis === | ||
+ | <source lang="lua"> | ||
+ | success = love.filesystem.write( name, data, size ) | ||
+ | </source> | ||
+ | === Arguments === | ||
+ | {{param|string|name|The name (and path) of the file.}} | ||
+ | {{param|Data|data|The Data object to write to the file.}} | ||
+ | {{param|number|size (all)|How many bytes to write.}} | ||
+ | === Returns === | ||
+ | {{param|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 == | == See Also == | ||
* [[parent::love.filesystem]] | * [[parent::love.filesystem]] | ||
+ | * [[love.filesystem.append]] | ||
[[Category:Functions]] | [[Category:Functions]] | ||
− | {{#set:Description=Write data to a file}} | + | {{#set:Description=Write data to a file.}} |
{{#set:Since=000}} | {{#set:Since=000}} | ||
== Other Languages == | == Other Languages == | ||
{{i18n|love.filesystem.write}} | {{i18n|love.filesystem.write}} |
Revision as of 22:59, 29 December 2013
Write data to a file in the save directory. If the file existed already, it will be completely replaced by the new contents.
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
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info