Difference between revisions of "love.filesystem.write"
(→Notes) |
(→Notes) |
||
Line 16: | Line 16: | ||
'''Writing to multiple lines''': On Windows, use the escape characters \r\n to move to the next line for writing. On any other OS \n alone should suffice. | '''Writing to multiple lines''': On Windows, use the escape characters \r\n to move to the next line for writing. On any other OS \n alone should suffice. | ||
<source lang="lua"> | <source lang="lua"> | ||
− | --example | + | --example (Windows) |
f = love.filesystem.newFile("note.txt") | f = love.filesystem.newFile("note.txt") | ||
f:open() | f:open() |
Revision as of 23:44, 20 October 2012
Write data to a file
Function
Synopsis
success = love.filesystem.write( name, data, size )
Arguments
string name
- The name (and path) of the file
string data
- The data that should be written 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 (only available with LÖVE 0.7.0 or higher).
Writing to multiple lines: On Windows, use the escape characters \r\n to move to the next line for writing. On any other OS \n alone should suffice.
--example (Windows)
f = love.filesystem.newFile("note.txt")
f:open()
for i = 1, 10 do f:write("This is line "..i.."!\r\n") end
f:close()
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