Page MenuHomeFeedback Tracker

remoteExecCall passes all local variables from upper scope if executed in singleplayer
New, NormalPublic

Details

Severity
Minor
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
Scripting
Steps To Reproduce

Run this code in singleplayer or just in editor's console:

doStuff = { 
diag_log str _a; 
}; 
 
_a = 123; 
remoteExecCall ["doStuff"];

"123" will be printed in the .rpt file.
If you run the same in a multiplayer session, _a will be undefined in the doStuff function, as expected.
If you replace remoteExecCall with remoteExec, it also works as expected (variable _a is not defined).

Additional Information

It can lead to unexpected behavior of functions that are meant to work both in SP and MP, adding complexity to multiplayer scenario debugging.
Obviously one would expect a remoteExecCall'ed function to be always run in a 'clear' environment.

Event Timeline

Sparker created this task.May 10 2019, 8:36 PM