loadFile: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(correction to previous note and formatting fix)
mNo edit summary
Line 12: Line 12:
____________________________________________________________________________________________
____________________________________________________________________________________________


| '''loadFile ''filename''''' |= Syntax
| [[String]] <nowiki>=</nowiki> '''loadFile "filename"''' |= Syntax


|p1= filename: [[String]] |= Parameter 1
|p1= filename: [[String]] |= Parameter 1
Line 19: Line 19:
____________________________________________________________________________________________
____________________________________________________________________________________________
   
   
|x1= <pre>loadFile "myFunction.sqf"</pre> |= Example 1
|x1= <pre>_contents = loadFile "myFunction.sqf"</pre> |= Example 1
____________________________________________________________________________________________
____________________________________________________________________________________________



Revision as of 05:11, 28 August 2007

Hover & click on the images for description

Description

Description:
Return content of given filename.
Groups:
Uncategorised

Syntax

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

Examples

Example 1:
_contents = loadFile "myFunction.sqf"

Additional Information

See also:
See also needed

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note

Notes

Unknown
Unknown
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")
Tactii 01:10, 11 July 2007 (CEST)
Tactii
This 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.

Bottom Section