(File):read

(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 See Also File

(File):open

(File):open Open the file for write, read or append. Function Synopsis ok, err = File:open( mode ) Arguments FileMode mode The mode to open the file in. Returns boolean ok True on success, false otherwise. string err The error string if an error occurred. Notes If you are getting the error message "Could not set write directory", try setting the save directory. This is done either with love.filesystem.setIdentity or by setting the identity field in love.conf (only available with love 0.

(File):lines

(File):lines Iterate over all the lines in a file. Function Synopsis iterator = File:lines( ) Arguments None. Returns function iterator The iterator (can be used in for loops). See Also File

(File):isOpen

(File):isOpen Available since LÖVE 0.9.0 This function is not supported in earlier versions. Gets whether the file is open. Function Synopsis open = File:isOpen( ) Arguments None. Returns boolean open True if the file is currently open, false otherwise. See Also File File:open

(File):isEOF

(File):isEOF Available since LÖVE 0.10.0 It has been renamed from File:eof. Gets whether end-of-file has been reached. Function Synopsis eof = File:isEOF( ) Arguments None. Returns boolean eof Whether EOF has been reached. See Also File

(File):getSize

(File):getSize Returns the file size. Function Synopsis size = File:getSize( ) Arguments None. Returns number size The file size. See Also File

(File):getMode

(File):getMode Available since LÖVE 0.9.0 This function is not supported in earlier versions. Gets the FileMode the file has been opened with. Function Synopsis mode = File:getMode( ) Arguments None. Returns FileMode mode The mode this file has been opened with. See Also File FileMode

(File):getFilename

(File):getFilename Available since LÖVE 0.10.0 This function is not supported in earlier versions. Gets the filename that the File object was created with. If the file object originated from the love.filedropped callback, the filename will be the full platform-dependent file path. Function Synopsis filename = File:getFilename( ) Arguments None. Returns string filename The filename of the File. See Also File

(File):getBuffer

(File):getBuffer Available since LÖVE 0.9.0 This function is not supported in earlier versions. Gets the buffer mode of a file. Function Synopsis mode, size = File:getBuffer( ) Arguments None. Returns BufferMode mode The current buffer mode of the file. number size The maximum size in bytes of the file's buffer. See Also File File:setBuffer File:write

(File):flush

(File):flush Available since LÖVE 0.9.0 This function is not supported in earlier versions. Flushes any buffered written data in the file to the disk. Function Synopsis success, err = File:flush( ) Arguments None. Returns boolean success Whether the file successfully flushed any buffered data to the disk. string err (nil) The error string, if an error occurred and the file could not be flushed. See Also File File:write File:setBuffer