Page 1 of 1

Pass values into child script in headless mode

Posted: 25 Nov 2021, 18:37
by kat
Hello,
Sorry for the simple question but I've not been able to find how to do it.

Please is there a way to pass a value into the child script when running in headless mode?

Like this:

./coppeliaSim.sh -h -s myscene.ttt <value to pass in>

Code: Select all

function coroutineMain()
 X= <value passed> 
print(X)
 end
So that I can run the same scene with different values without editing the child script?
Best,
Kat

Re: Pass values into child script in headless mode

Posted: 26 Nov 2021, 05:21
by coppelia
Hello Kat,

yes, you can do this with named parameters and the command-line option -G, e.g.

Code: Select all

./coppeliaSim.sh -GmyValue=hello
Then you can retrieve the value with sim.getStringNamedParam / sim.getNamedStringParam

Cheers

Re: Pass values into child script in headless mode

Posted: 26 Nov 2021, 17:50
by kat
Thank you, that's just what I was after!