ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. fileGetContents

Function

fileGetContents

Server and clientFilesIdentical to MTA:SA

Reads a whole file in one call. Accepts a file handle or a path (it then opens and closes the file itself).

Syntax

string fileGetContents(file/string fileOrPath [, bool verifyContents = true])

Arguments

fileOrPathfile/string
A handle or a path.
verifyContentsbool, optional = true
For compatibility with existing scripts.

Returns

The file content, or false.

Example

local json = fileGetContents("config.json")
local config = json and fromJSON(json) or {}

See also