loadFile: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "\[\[Category:[ _]?Scripting[ _]Commands[ _]Take[ _]On[ _]Helicopters(\|.*)?\]\]" to "{{GameCategory|tkoh|Scripting Commands}}") |
Lou Montana (talk | contribs) m (Text replacement - "_{10,} " to "") |
||
Line 1: | Line 1: | ||
{{Command|Comments= | {{Command|Comments= | ||
| ofpr |Game name= | | ofpr |Game name= | ||
Line 8: | Line 7: | ||
|gr1= Program Flow |GROUP1= | |gr1= Program Flow |GROUP1= | ||
| Return content of given filename as string. If you plan to [[compile]] said string, be aware that the file shouldn't contain comments or [[compile]] will throw an error. If there are comments, use [[preprocessFile]]/[[preprocessFileLineNumbers]] instead. <br><br> | | Return content of given filename as string. If you plan to [[compile]] said string, be aware that the file shouldn't contain comments or [[compile]] will throw an error. If there are comments, use [[preprocessFile]]/[[preprocessFileLineNumbers]] instead. <br><br> | ||
{{Warning | If the file you are loading is not prepared using UTF-8 encoding and contains some characters [[toArray | with codes]] > 127, they might convert incorrectly}} |DESCRIPTION= | {{Warning | If the file you are loading is not prepared using UTF-8 encoding and contains some characters [[toArray | with codes]] > 127, they might convert incorrectly}} |DESCRIPTION= | ||
| [[loadFile]] fileName |SYNTAX= | | [[loadFile]] fileName |SYNTAX= | ||
Line 19: | Line 16: | ||
| [[String]] |RETURNVALUE= | | [[String]] |RETURNVALUE= | ||
|x1= <code>_contents = [[loadFile]] "wantedString.txt";</code> |EXAMPLE1= | |x1= <code>_contents = [[loadFile]] "wantedString.txt";</code> |EXAMPLE1= | ||
|x2= <code>_contents = [[compile]] [[loadFile]] "myFunction.sqf"; {{codecomment|// will compile string into code}}</code> |EXAMPLE2= | |x2= <code>_contents = [[compile]] [[loadFile]] "myFunction.sqf"; {{codecomment|// will compile string into code}}</code> |EXAMPLE2= | ||
| [[fileExists ]] [[preprocessFile]], [[preprocessFileLineNumbers]] |SEEALSO= | | [[fileExists ]] [[preprocessFile]], [[preprocessFileLineNumbers]] |SEEALSO= |
Revision as of 01:59, 17 January 2021
Description
- Description:
- Return content of given filename as string. If you plan to compile said string, be aware that the file shouldn't contain comments or compile will throw an error. If there are comments, use preprocessFile/preprocessFileLineNumbers instead.
- Groups:
- Program Flow
Syntax
Examples
- Example 1:
_contents = loadFile "wantedString.txt";
- Example 2:
_contents = compile loadFile "myFunction.sqf"; // will compile string into code
Additional Information
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
- Posted on 25 January 2016 - 12:13
- James
- Notice that you will have to activate file patching via -filePatching. Otherwise, execVM and loadFile will *not* load any files outside your mission folder (like the global scripts).
Bottom Section
Categories:
- Scripting Commands
- Introduced with Operation Flashpoint: Resistance version 1.90
- Operation Flashpoint: Resistance: New Scripting Commands
- Operation Flashpoint: Resistance: Scripting Commands
- Command Group: Program Flow
- Scripting Commands OFP 1.96
- Scripting Commands OFP 1.99
- ArmA: Armed Assault: Scripting Commands
- Arma 2: Scripting Commands
- Arma 3: Scripting Commands
- Take On Helicopters: Scripting Commands