Views
love.filesystem.newFile
Creates a new File object. It needs to be opened before it can be accessed.
Function
Synopsis
Arguments
string filename
- The filename of the file.
Returns
File file
- The new File object.
Notes
Please note that this function will not return any error message (e.g. if you use an invalid filename) because it just creates the File Object. You can still check if the file is valid by using File:open which returns a boolean and an error message if something goes wrong while opening the file.
Function
Available since LÖVE 0.9.0 |
This variant is not supported in earlier versions. |
Creates a File object and opens it for reading, writing, or appending.
Synopsis
Arguments
Returns
File file
- The new File object, or nil if an error occurred.
string errorstr
- The error string if an error occurred.
Examples
Open a file and read everything
file:open("r")
data = file:read()
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