Difference between revisions of "love.filesystem.newFileData"

m
(Updated for 11.0)
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{newin|[[0.7.0]]|070|type=function}}
 
 
Creates a new [[FileData]] object.
 
Creates a new [[FileData]] object.
  
 
== Function ==
 
== Function ==
 +
=== Synopsis ===
 +
<source lang="lua">
 +
data = love.filesystem.newFileData( contents, name )
 +
</source>
 +
=== Arguments ===
 +
{{param|string|contents|The contents of the file.}}
 +
{{param|string|name|The name of the file.}}
 +
=== Returns ===
 +
{{param|FileData|data|Your new FileData.}}
 +
 +
== Function ==
 +
{{newin|[[0.9.0]]|090|type=variant}}
 +
Creates a new [[FileData]] from a file on the storage device.
 +
=== Synopsis ===
 +
<source lang="lua">
 +
data, err = love.filesystem.newFileData( filepath )
 +
</source>
 +
=== Arguments ===
 +
{{param|string|filepath|Path to the file.}}
 +
=== Returns ===
 +
{{param|FileData|data|The new FileData, or [[nil]] if an error occurred.}}
 +
{{param|string|err|The error string, if an error occurred.}}
 +
 +
== Function ==
 +
{{oldin|[[11.0]]|110|type=variant|text=The variant which decodes base64 data has been replaced by [[love.data.decode]]}}
 
=== Synopsis ===
 
=== Synopsis ===
 
<source lang="lua">
 
<source lang="lua">
Line 10: Line 34:
 
{{param|string|contents|The contents of the file.}}
 
{{param|string|contents|The contents of the file.}}
 
{{param|string|name|The name of the file.}}
 
{{param|string|name|The name of the file.}}
{{param|FileDecoder|decoder ("file")|The method to use when decoding the contents.}}
+
{{param|FileDecoder|decoder|The method to use when decoding the contents.}}
 
=== Returns ===
 
=== Returns ===
 
{{param|FileData|data|Your new FileData.}}
 
{{param|FileData|data|Your new FileData.}}
 +
 
== See Also ==
 
== See Also ==
 
* [[parent::love.filesystem]]
 
* [[parent::love.filesystem]]
Line 18: Line 43:
 
[[Category:Functions]]
 
[[Category:Functions]]
 
{{#set:Description=Creates a new [[FileData]] object.}}
 
{{#set:Description=Creates a new [[FileData]] object.}}
 +
{{#set:Since=070}}
 +
{{#set:PrettySince=0.7.0}}
 
== Other Languages ==
 
== Other Languages ==
 
{{i18n|love.filesystem.newFileData}}
 
{{i18n|love.filesystem.newFileData}}

Revision as of 20:06, 1 April 2018

Creates a new FileData object.

Function

Synopsis

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

Arguments

string contents
The contents of the file.
string name
The name of the file.

Returns

FileData data
Your 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