{"name":"loadFile","title":"loadFile","type":"command","url":"https://community.bistudio.com/wiki/loadFile","revid":379449,"updated":"2026-10-31T00:08:00Z","groups":["Program Flow"],"status":"ok","games":{"ofp":"1.90","ofpe":"1.00","arma1":"1.00","arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"ofp 1.90","arma3_since":"0.50","description":"Returns the content of given files. If you plan to compile said string, be aware that the file should not contain comments or compile will throw an error. If there are comments, use preprocessFile/preprocessFileLineNumbers instead.\n\n> [!WARNING]\n> If the file is not prepared using UTF-8 encoding and contains some characters with codes > 127, they might convert incorrectly.","syntaxes":[{"syntax":"loadFile fileName","params":[{"name":"fileName","type":"String","type_expr":"String"}],"returns":{"type":"String","type_expr":"String"},"form":"unary","right":{"text":"fileName"}}],"examples":[{"code":["_contents = loadFile \"wantedString.txt\";"]},{"code":["_contents = compile loadFile \"myFunction.sqf\"; // will compile string into code"]}],"see_also":["fileExists","preprocessFile","preprocessFileLineNumbers"],"notes":[{"user":"James","date":"2016-01-25T12:13:00Z","text":"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)."}]}