Read the contents of a file.

== Function ==
=== Synopsis ===
<source lang="lua">
contents, size = love.filesystem.read( name, size )
</source>
=== Arguments ===
{{param|string|name|The name (and path) of the file.}}
{{param|number|size (all)|How many bytes to read.}}
=== Returns ===
{{param|string|contents|The file contents.}}
{{param|number|size|How many bytes have been read.}}
=== Returns (if error on reading) ===
{{param|nil|contents|returns nil as content.}}
{{param|string|error|returns an error message.}}

== Function ==
{{newin|[[11.0]]|110|type=variant}}
Reads the contents of a file into either a string or a [[FileData]] object.
=== Synopsis ===
<source lang="lua">
contents, size = love.filesystem.read( container, name, size )
</source>
=== Arguments ===
{{param|ContainerType|container|What type to return the file's contents as.}}
{{param|string|name|The name (and path) of the file}}
{{param|number|size (all)|How many bytes to read}}
=== Returns ===
{{param|value|contents|[[FileData]] or string containing the file contents.}}
{{param|number|size|How many bytes have been read.}}
=== Returns (if error on reading) ===
{{param|nil|contents|returns nil as content.}}
{{param|string|error|returns an error message.}}

== See Also ==
* [[parent::love.filesystem]]
[[Category:Functions]]
{{#set:Description=Read the contents of a file.}}
{{#set:Since=000}}
== Other Languages ==
{{i18n|love.filesystem.read}}