(File):read

Read a number of bytes from a file.

Function

Synopsis

contents, size = File:read( bytes )

Arguments

number bytes (all)
The number of bytes to read.

Returns

string contents
The contents of the read bytes.
number size
How many bytes have been read.

Function

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

Reads the contents of a file into either a string or a FileData object.

Synopsis

contents, size = File:read( container, bytes )

Arguments

ContainerType container
What type to return the file's contents as.
number bytes (all)
The number of bytes to read.

Returns

value contents
FileData or string containing the read bytes.
number size
How many bytes have been read.

See Also


© 2006–2020 LÖVE Development Team
Licensed under the GNU Free Documentation License, Version 1.3.
https://love2d.org/wiki/(File):read