love.filesystem.openFile

Available since LÖVE 12.0
This function is not supported in earlier versions.


Opens a new File object, which represents an existing or new file on disk.

Function

Synopsis

file, errorstr = love.filesystem.openFile( filename, mode )

Arguments

string filename
The filename of the file.
FileMode mode
The mode to open the file in.

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 = love.filesystem.openFile("data.txt", "r")
data = file:read()
file:close()
-- use the data ...

See Also

Other Languages