Difference between revisions of "(File):write"
m |
(→Function) |
||
Line 9: | Line 9: | ||
=== Returns === | === Returns === | ||
{{param|boolean|success|Whether the operation was successful}} | {{param|boolean|success|Whether the operation was successful}} | ||
+ | === Notes === | ||
+ | '''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"> | ||
+ | --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() | ||
+ | </source> | ||
+ | |||
== See Also == | == See Also == | ||
* [[parent::File]] | * [[parent::File]] |
Revision as of 23:46, 20 October 2012
Write data to a file
Function
Synopsis
success = File:write( data )
Arguments
string data
- The data to write
Returns
boolean success
- Whether the operation was successful
Notes
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