Reads and processes the content of the specified file.
The processed file is stripped of any comments, and any preprocessor commands that are executed when the string is returned.
_a = 1; // one _b = 2; // two #define ten 10 _c = ten; // ten
Would be returned as:
_a = 1; _b = 2; _c = 10;
Due to the hard-drive access this command executes (and the lack of caching), this command should not be used in time-critical script loops.
If no path is supplied with the script name, then the file is assumed to be in the mission folder. If the specified script is not found in there, other locations are searched, depending on the VBS version and current mode (Editor, SP, or MP). See Location for details.
_content = preprocessFile "myFunction.sqf"
|See also:||preprocessFileLineNumbers, clearPreprocessCache, PreProcessor Commands|
|Problems:||In V2.0+, this command returns the same data as preprocessFileLineNumbers (it includes the header line).|
- Posted on Deb 18, 2011
- To retrieve a return value from a regular script (i.e. to have it behave like a function), put the return value into the last line (with or without a trailing semicolon), and call it with call compile preProcessFile:
_unit = _this select 0; _health = getDammage _unit; _health
Call syntax (from another script):
_damage=[player] call compile preprocessFile "chkDamage.sqf";