er2.runOnce 148

Execute an external file without stopping execution of current scrip, if the external file was never executed before during the mission. External file must be placed within the folder '[mission folder]/scripts/general/' or any subfolder


Return value

Return TypeDescription
boolTrue if the new script have been executed correctly. If the script was already executed previously during the same mission, it will not be Executed and the function will return False

Parameters

ParameterTypeDescription
1stringThe sub path and file name to load

Examples

Example 145

-- Execute a subfile from "<mission folder>/scripts/general/somefile.lua" making sure it was not executed already in the past
runOnce("somefile.lua")

Example 146

-- Execute a subfile from "<mission folder>/scripts/general/somefolder/somefile.lua" making sure it was not executed already in the past
runOnce("somefolder/somefile.lua")

Back to Scripting API