Difference between revisions of "File"

m (Clarificate that Files can be passed as parameters to functions taking filepath)
 
(6 intermediate revisions by 5 users not shown)
Line 1: Line 1:
Represents a file on the filesystem.
+
Represents a file on the filesystem. A function that takes a file path can also take a File.
 
== Constructors ==
 
== Constructors ==
{{#ask: [[Category:Functions]] [[Constructs::File]]
+
{{#ask: [[Category:Functions]] [[Constructs::File]] [[Concept:Current]]
 
| headers=hide
 
| headers=hide
 
| default=None.
 
| default=None.
 +
| format=template
 +
| template=ListingFields
 +
| introtemplate=ListingIntro
 +
| outrotemplate=ListingOutro
 
| ?Description
 
| ?Description
 +
| ?PrettySince
 +
| ?PrettyRemoved
 
}}
 
}}
 
== Functions ==
 
== Functions ==
 
These functions have parentheses in odd places. This is because the ''File:'' namespace is reserved in Mediawiki.
 
These functions have parentheses in odd places. This is because the ''File:'' namespace is reserved in Mediawiki.
{{#ask: [[Category:Functions]] [[parent::File]]
+
{{#ask: [[Category:Functions]] [[parent::File||Object]] [[Concept:Current]]
| headers=hide
 
| ?Description
 
}}
 
{{#ask: [[Category:Functions]] [[parent::Object]]
 
 
| headers=hide
 
| headers=hide
 +
| format=template
 +
| template=ListingFields
 +
| introtemplate=ListingIntro
 +
| outrotemplate=ListingOutro
 
| ?Description
 
| ?Description
 +
| ?PrettySince
 +
| ?PrettyRemoved
 
}}
 
}}
 
== Enums ==
 
== Enums ==
{{#ask: [[Category:Enums]] [[parent::File]]
+
{{#ask: [[Category:Enums]] [[parent::File]] [[Concept:Current]]
 
| headers=hide
 
| headers=hide
 +
| format=template
 +
| template=ListingFields
 +
| introtemplate=ListingIntro
 +
| outrotemplate=ListingOutro
 
| ?Description
 
| ?Description
 +
| ?PrettySince
 +
| ?PrettyRemoved
 
}}
 
}}
 +
== Supertypes ==
 +
* [[parent::Object]]
 
== See Also ==
 
== See Also ==
 
* [[parent::love.filesystem]]
 
* [[parent::love.filesystem]]
 
[[Category:Types]]
 
[[Category:Types]]
 
{{#set:Description=Represents a file on the filesystem.}}
 
{{#set:Description=Represents a file on the filesystem.}}
 +
{{#set:Since=000}}
 
== Other Languages ==
 
== Other Languages ==
 
{{i18n|File}}
 
{{i18n|File}}

Latest revision as of 23:27, 22 June 2016

Represents a file on the filesystem. A function that takes a file path can also take a File.

Constructors

love.filesystem.newFile Creates a new File object.

Functions

These functions have parentheses in odd places. This is because the File: namespace is reserved in Mediawiki.

(File):close Closes a File.
(File):eof If the end-of-file has been reached Removed in 0.10.0
(File):flush Flushes any buffered written data in the file to disk. Added since 0.9.0
(File):getBuffer Gets the buffer mode of a file. Added since 0.9.0
(File):getFilename Gets the filename that the File object was created with. Added since 0.10.0
(File):getMode Gets the FileMode the file has been opened with. Added since 0.9.0
(File):getSize Returns the file size.
(File):isEOF Gets whether end-of-file has been reached. Added since 0.10.0
(File):isOpen Gets whether the file is open. Added since 0.9.0
(File):lines Iterate over all the lines in a file.
(File):open Open the file for write, read or append.
(File):read Read a number of bytes from a file
(File):seek Seek to a position in a file
(File):setBuffer Sets the buffer mode for a file opened for writing or appending. Added since 0.9.0
(File):tell Returns the position in the file.
(File):write Write data to a file.
Object:release Immediately destroys the object's Lua reference. Added since 11.0
Object:type Gets the type of the object as a string.
Object:typeOf Checks whether an object is of a certain type.

Enums

BufferMode Buffer modes for File objects. Added since 0.9.0
FileMode The different modes you can open a File in.

Supertypes

See Also


Other Languages