File
file.size
Shared
Retrieves the size of a specified file
Syntax
local size = file.size(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 for size computation |
Returns
| Type | Name | Description |
|---|---|---|
int / bool | size | Computed file size on successful execution, or false on failure |
Examples
engine.print("info", "File size:", file.size("files/images/test.png"))engine.print("info", "File size:", file.size(":resource_a/files/images/test.png"))