Difference between revisions of "(File):write"
(Added missing Data variant) |
m (Add information about returned error message.) |
||
Line 4: | Line 4: | ||
=== Synopsis === | === Synopsis === | ||
<source lang="lua"> | <source lang="lua"> | ||
− | success = File:write( data, size ) | + | success, err = File:write( data, size ) |
</source> | </source> | ||
=== Arguments === | === Arguments === | ||
Line 11: | Line 11: | ||
=== Returns === | === Returns === | ||
{{param|boolean|success|Whether the operation was successful.}} | {{param|boolean|success|Whether the operation was successful.}} | ||
+ | {{param|string|err|The error string if an error occurred.}} | ||
== Function == | == Function == | ||
=== Synopsis === | === Synopsis === | ||
<source lang="lua"> | <source lang="lua"> | ||
− | success = File:write( data, size ) | + | success, err = File:write( data, size ) |
</source> | </source> | ||
=== Arguments === | === Arguments === | ||
Line 22: | Line 23: | ||
=== Returns === | === Returns === | ||
{{param|boolean|success|Whether the operation was successful.}} | {{param|boolean|success|Whether the operation was successful.}} | ||
+ | {{param|string|errorstr|The error string if an error occurred.}} | ||
== Notes == | == Notes == |
Revision as of 17:37, 16 January 2015
Write data to a file.
Contents
Function
Synopsis
success, err = File:write( data, size )
Arguments
Returns
boolean success
- Whether the operation was successful.
string err
- The error string if an error occurred.
Function
Synopsis
success, err = File:write( data, size )
Arguments
Returns
boolean success
- Whether the operation was successful.
string errorstr
- The error string if an error occurred.
Notes
Writing to multiple lines: In Windows, some text editors (e.g. Notepad) only treat CRLF ("\r\n") as a new line.
--example
f = love.filesystem.newFile("note.txt")
f:open("w")
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