file.Exists
From Garry's Mod
Contents |
Description
Returns a boolean of whether the file or directory exists or not.
Arguments
string name
The file or directory's name.
Arguments
string path
The path of where to look for the file.
- "GAME" Structured like base folder (garrysmod/), searches all the mounted content (main folder, addons, mounted games etc)
- "LUA" or "lsv" - All Lua folders (lua/) including gamesmodes and addons
- "DATA" Data folder (garrysmod/data)
- "MOD" Strictly the game folder (garrysmod/), ignores mounting.
Returns
Returns true if the file exists and false if it is not.
Examples
Example
Prints whether the data folder exists in the base directory.
print( file.Exists("data", "GAME") )
Output:
true