Difference between revisions of "love.filesystem.getInfo"

(Created page)
 
m
Line 11: Line 11:
 
=== Returns ===
 
=== Returns ===
 
{{param|table|info (nil)|A table containing information about the specified path, or nil if nothing exists at the path. The table contains the following fields:}}
 
{{param|table|info (nil)|A table containing information about the specified path, or nil if nothing exists at the path. The table contains the following fields:}}
{{subparam|FileType|type|The type of object at the path (file, directory, symlink, etc.)}}
+
{{subparam|FileType|type|The type of the object at the path (file, directory, symlink, etc.)}}
 
{{subparam|number|size (nil)|The size in bytes of the file, or nil if it can't be determined.}}
 
{{subparam|number|size (nil)|The size in bytes of the file, or nil if it can't be determined.}}
 
{{subparam|number|modtime (nil)|The file's last modification time in seconds since the unix epoch, or nil if it can't be determined.}}
 
{{subparam|number|modtime (nil)|The file's last modification time in seconds since the unix epoch, or nil if it can't be determined.}}
Line 26: Line 26:
 
=== Returns ===
 
=== Returns ===
 
{{param|table|info (nil)|The table given as an argument, or nil if nothing exists at the path. The table will be filled in with the following fields:}}
 
{{param|table|info (nil)|The table given as an argument, or nil if nothing exists at the path. The table will be filled in with the following fields:}}
{{subparam|FileType|type|The type of object at the path (file, directory, symlink, etc.)}}
+
{{subparam|FileType|type|The type of the object at the path (file, directory, symlink, etc.)}}
 
{{subparam|number|size (nil)|The size in bytes of the file, or nil if it can't be determined.}}
 
{{subparam|number|size (nil)|The size in bytes of the file, or nil if it can't be determined.}}
 
{{subparam|number|modtime (nil)|The file's last modification time in seconds since the unix epoch, or nil if it can't be determined.}}
 
{{subparam|number|modtime (nil)|The file's last modification time in seconds since the unix epoch, or nil if it can't be determined.}}

Revision as of 01:52, 29 November 2017

Available since LÖVE 0.11.0
This function replaces love.filesystem.exists, isFile, isDirectory, isSymlink, getLastModified, and getSize.

Gets information about the specified file or directory.

Function

Synopsis

info = love.filesystem.getInfo( path )

Arguments

string path
The file or directory path to check.

Returns

table info (nil)
A table containing information about the specified path, or nil if nothing exists at the path. The table contains the following fields:
FileType type
The type of the object at the path (file, directory, symlink, etc.)
number size (nil)
The size in bytes of the file, or nil if it can't be determined.
number modtime (nil)
The file's last modification time in seconds since the unix epoch, or nil if it can't be determined.

Function

This variant accepts an existing table to fill in, instead of creating a new one.

Synopsis

info = love.filesystem.getInfo( path, info )

Arguments

string path
The file or directory path to check.
table info
A table which will be filled in with info about the specified path.

Returns

table info (nil)
The table given as an argument, or nil if nothing exists at the path. The table will be filled in with the following fields:
FileType type
The type of the object at the path (file, directory, symlink, etc.)
number size (nil)
The size in bytes of the file, or nil if it can't be determined.
number modtime (nil)
The file's last modification time in seconds since the unix epoch, or nil if it can't be determined.

See Also

Other Languages