fileGetContents
Shared
Reads a whole file at once, without opening it.
string|false fileGetContents(string path)
Parameters
| Name | Type | Description |
|---|---|---|
| path | string | A path inside the calling resource, or @resource/path for another resource's file. |
Returns
The contents, or false if the file does not exist, is a folder or could not be read.
A path may not contain .., \ or :, nor start with /. Another resource's files can only be read; an invalid path logs a warning and the function returns false.
Example
local text = fileGetContents("config.json")
local config = text and fromJSON(text) or {}