loadFile: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
(note fix)
Line 29: Line 29:
<dl class="command_description">
<dl class="command_description">
<!-- Note Section BEGIN -->
<!-- Note Section BEGIN -->
<dd class="notedate">Unknown
<dd class="notedate"> 01:37, 28 November 2006
<dt class="note">'''Unknown'''<dd class="note">In Armed Assault, the 'loadfile' command must be preceded by the 'compile' command to work.
<dt class="note">[[User:Pennywise|Pennywise]]<dd class="note">In Armed Assault, the 'loadfile' command must be preceded by the 'compile' command to work.
<br>
<br>
Ex OFP 1.96:  _falarmEvent = loadfile ("syswarn\falarmEvent.sqf")
Ex OFP 1.96:  _falarmEvent = loadfile ("syswarn\falarmEvent.sqf")
Line 36: Line 36:
Ex ArmA 1.0:  _falarmEvent = compile loadfile ("syswarn\falarmEvent.sqf")
Ex ArmA 1.0:  _falarmEvent = compile loadfile ("syswarn\falarmEvent.sqf")


<dd class="notedate">[[User:Tactii|Tactii]] 01:10, 11 July 2007 (CEST)
<dd class="notedate"> 01:10, 11 July 2007 (CEST)
<dt class="note">'''[[User:Tactii|Tactii]]'''<dd class="note">This is not entirely accurate. [[loadFile]] only needs to be preceded with [[compile]] when loading [[Code|code]] (for example, a [[Function|function]] contained in an [[Script (File)|.sqf file]]). Using [[loadFile]] without [[compile]] will return a [[String|string]], which, in some cases, is exactly what you want.
<dt class="note">'''[[User:Tactii|Tactii]]'''<dd class="note">The note by [[User:Pennywise|Pennywise]] is not entirely accurate. [[loadFile]] only needs to be preceded with [[compile]] when loading [[Code|code]] (for example, a [[Function|function]] contained in an [[Script (File)|.sqf file]]). Using [[loadFile]] without [[compile]] will return a [[String|string]], which, in some cases, is exactly what you want.


<dd class="notedate">[[User:neokika]] 11:17, 02 December 2012 (ZULU)
<dd class="notedate"> 11:17, 02 December 2012 (ZULU)
<dt class="note">'''[[neokika]]'''<dd class="note">Please note that any comment you have within the file you load will be included, to get around that use preprocessFile instead.
<dt class="note">'''[[neokika]]'''<dd class="note">Please note that any comment you have within the file you load will be included, to get around that use preprocessFile instead.
<!-- Note Section END -->
<!-- Note Section END -->

Revision as of 02:07, 7 April 2015

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:
preprocessFileLineNumberspreprocessFile

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

01:37, 28 November 2006
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")
01:10, 11 July 2007 (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.
11:17, 02 December 2012 (ZULU)
neokika
Please note that any comment you have within the file you load will be included, to get around that use preprocessFile instead.

Bottom Section