FileExists

From Multi Theft Auto: Wiki
Revision as of 17:08, 2 April 2010 by Awwu (talk | contribs) (Created page with '__NOTOC__ {{Server function}} This functions checks whether a specified file exists inside a resource. ==Syntax== <syntaxhighlight lang="lua"> bool fileExists ( string filePath ) </syntaxhighlight> ===Req…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This functions checks whether a specified file exists inside a resource.

Syntax

bool fileExists ( string filePath )

Required Arguments

  • filePath: The filepath of the file, whose existence is going to be checked, in the following format: ":resourceName/path". 'resourceName' is the name of the resource the file is checked to be in, and 'path' is the path from the root directory of the resource to the file.
For example, if you want to check whether a file named 'myfile.txt' exists in the resource 'mapcreator', it can be done from another resource this way: fileExists(":mapcreator/myfile.txt").
If the file, whose existence is going to be checked, is in the current resource, only the file path is necessary, e.g. fileExists("myfile.txt").

Returns

Returns true if the file exists, false otherwise.

Example

--TODO

See Also