util.file.exists
Shared
Retrieves the existence of a specified file
Syntax
local valid = util.file.exists(
path
)Prefix the path with :resourcename to access files from another running resource.
- Local path — resolves relative to the current resource's directory.
- Cross-resource path — prefix with
:resourcenameto resolve relative to another running resource's directory. - Example —
:resource_a/files/images/test.pngaccessesfiles/images/test.pnginsideresource_a.
Parameters
| Type | Name | Description |
|---|---|---|
string | path | File path to verify for existence |
Returns
| Type | Name | Description |
|---|---|---|
bool | valid | Specified file's existence |
Examples
core.engine.print("info", "File exists:", util.file.exists("files/images/test.png"))core.engine.print("info", "File exists:", util.file.exists(":resource_a/files/images/test.png"))