loadFile

From Bohemia Interactive Community
Jump to: navigation, search
Introduced with Operation Flashpoint: Resistance version 1.90
  Effects of this scripting command are not broadcasted over the network and remain local to the client the command is executed on

Click on the images for descriptions

Introduced in

Game:
Operation Flashpoint: Resistance
Version:
1.90

Description

Description:
Return content of given filename.

Syntax

Syntax:
loadFile filename
Parameters:
filename: String
Return Value:
String

Examples

Example 1:
_contents = loadFile "myFunction.sqf";

Additional Information

Multiplayer:
-
See also:
preprocessFileLineNumberspreprocessFile

Notes

Only post proven facts here. Report bugs on the feedback tracker. Use the talk page or the forums for discussions.
Add New Note | How To

Notes

Posted on 28 November 2006 - 01:37
Pennywise
In Armed Assault, the 'loadfile' command must be preceded by the 'compile' command to work.
Ex OFP 1.96: _falarmEvent = loadfile ("syswarn\falarmEvent.sqf")
Ex ArmA 1.0: _falarmEvent = compile loadfile ("syswarn\falarmEvent.sqf")
Posted on 11 July 2007 - 01:10 (CEST)
Tactii
The note by Pennywise is not entirely accurate. loadFile only needs to be preceded with compile when loading code (for example, a function contained in an .sqf file). Using loadFile without compile will return a string, which, in some cases, is exactly what you want.
Posted on 02 December 2012 - 11:17 (ZULU)
neokika
Please note that any comment you have within the file you load will be included, to get around that use preprocessFile instead.
Posted on 25 January 2016 - 12:13
James
Notice that you will have to activate file patching via -filePatching [[1]]. Otherwise, execVM and loadFile will *not* load any files outside your mission folder (like the global scripts). For more info see CMA:DevelopmentSetup (since Arma 3 1.49+).

Bottom Section