love.filesystem.newFileData

Creates a new FileData object from a file on disk, or from a string in memory.

Function

Creates a new FileData object from a string in memory.

Synopsis

data = love.filesystem.newFileData( contents, name )

Arguments

string contents
The contents of the file in memory represented as a string.
string name
The name of the file. The extension may be parsed and used by LÖVE when passing the FileData object into love.audio.newSource.

Returns

FileData data
The new FileData.

Function

Available since LÖVE 0.9.0
This variant is not supported in earlier versions.

Creates a new FileData from a file on the storage device.

Synopsis

data, err = love.filesystem.newFileData( filepath )

Arguments

string filepath
Path to the file.

Returns

FileData data
The new FileData, or nil if an error occurred.
string err
The error string, if an error occurred.

Function

Removed in LÖVE 11.0
The variant which decodes base64 data has been replaced by love.data.decode.

Synopsis

data = love.filesystem.newFileData( contents, name, decoder )

Arguments

string contents
The contents of the file.
string name
The name of the file.
FileDecoder decoder
The method to use when decoding the contents.

Returns

FileData data
Your new FileData.

See Also


Other Languages