loadFile: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "_{10,} " to "") |
Lou Montana (talk | contribs) m (Text replacement - " *\| *([Cc]omments|COMMENTS|Game|[Gg]ame [Nn]ame|Game [Vv]ersion|Game Version \(number surrounded by NO SPACES\)|Multiplayer Arguments( \("local" or "global"\))?|Effects|Multiplayer Effects( \("local" or "global"\))?|Multiplayer Exe...) |
||
Line 1: | Line 1: | ||
{{Command | {{Command | ||
| ofpr | | ofpr | ||
|1.90 | |1.90 | ||
|gr1= Program Flow | |gr1= Program Flow | ||
| 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}} | {{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}} | ||
| [[loadFile]] fileName | | [[loadFile]] fileName | ||
|p1= fileName: [[String]] | |p1= fileName: [[String]] | ||
| [[String]] | | [[String]] | ||
|x1= <code>_contents = [[loadFile]] "wantedString.txt";</code> | |x1= <code>_contents = [[loadFile]] "wantedString.txt";</code> | ||
|x2= <code>_contents = [[compile]] [[loadFile]] "myFunction.sqf"; {{codecomment|// will compile string into code}}</code> | |x2= <code>_contents = [[compile]] [[loadFile]] "myFunction.sqf"; {{codecomment|// will compile string into code}}</code> | ||
| [[fileExists ]] [[preprocessFile]], [[preprocessFileLineNumbers]] | | [[fileExists ]] [[preprocessFile]], [[preprocessFileLineNumbers]] | ||
}} | }} |
Revision as of 01:04, 18 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