File:read

Edit

Reads data from the file.

data, size = File:read(bytes)

Arguments

NameTypeDescription
bytesnumber The number of bytes to read from the file, or nil to read the rest of the file.

Returns

NameTypeDescription
datastring The data that was read, or nil if an error occurred.
sizenumber The number of bytes that were read, or the error message if an error occurred.

Notes

The file must have been opened for reading.

The maximum number of bytes that can be read at a time is 2^53 - 1.

See also