I was not talking of giving the object's name as argument to the script generator function.

What I meant was: forget about the script generator and just pass the simulationobject as parameter:

fixedsimulationfunc(mysimulation);

or better as it is more oop like:

mysimulation.run();

Here you use the this object to access mysimulation..

ScriptCode:
Qt Code:
  1. function run()
  2. {
  3. ++this.time;
  4. }
  5.  
  6. function()
  7. {
  8. // Initialize the run script.. maybe differently for different simulation objects?
  9. simulation.run = run;
  10. ...
  11. simulation.run();
  12. }
To copy to clipboard, switch view to plain text mode 

Maybe I did still not catch why you want to do this.. Maybe you are forced to use the structure as it is.

Best of luck to you!

Johannes