Page tree
Skip to end of metadata
Go to start of metadata


Introduced in

Version:1.00

Description

Description:

Returns the contents of the given file.

The file can either contain data, which can then be interpreted as a string, or it can contain code, which, once loaded into a string, can be executed using call compile.

Note: Be aware that the scope of the called code is on a lower level than the calling script, so in order to read any variables that were modified (or defined) in that code, they must be initialized at the higher level already (see compile for example).

Syntax

Syntax:loadFile filename
Parameters:
  • filename: String - If no path (or a relative path - for example, scripts\doit.sqf) is given, then the file is read from the mission folder. Absolute paths (for example, c:\bi\scripts\doit.sqf) can be used as well.
Return Value:String - Contents of the read file.

Examples

Examples:
_data = loadFile "d:\vbs2\data\myData.txt"

_code = loadFile "myFunction.txt";
call compile _code;

Additional Information

See also: preprocessFile, VBS2PluginFileAccess, call, compile
Multiplayer: 
Problems: 

Notes