My program works in simulation but fails in game mode
I've set up my code so that my main module consists of only the following:
var main = require('main2');
main();
This works in simulation's survival training mode, where main is a function. However, in the online survival mode I have started getting the following error:
main:3
main();
^
TypeError: object is not a function
at main:3:1
at process.emit (events.js:110:17)
Why have I started getting this error in the online survival mode?
Best Answer
This has been just fixed. Now require should work correctly at server-side.
Pictures about "My program works in simulation but fails in game mode"



SOLIDWORKS Simulation Failure Mode Analysis - Impact
More answers regarding my program works in simulation but fails in game mode
Answer 2
I would expect that to invoke the function main in main2, you would use main.main(). var main is an object which contains the function main.
As to why it works in one context rather than the other, no idea. Perhaps you should ensure that the require is not actually returning empty/NULL/FILE NOT NOT FOUND. (should it be "./main2.js" etc.)
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Oleksandr Pidvalnyi, Oleksandr Pidvalnyi, Tima Miroshnichenko, Tima Miroshnichenko
