Page 1 of 1

Lua Script input and output

Posted: 18 Jun 2021, 00:41
by zhy149
Hello,

Is there a way to do console input in Coppeliasim? Can I open a text file or other files inside a child script and write to a file?
Thank you very much!

Re: Lua Script input and output

Posted: 18 Jun 2021, 10:26
by fferri
If you mean to read standard input, you can do so in a plugin, but it is not recommended as it is not a modular solution (what if another plugin reads from stdin as well?).

If you need input from the user, you can use the UI plugin.

If you need input/output with external applications, you can read/write files in Lua with the io module, or use one of the many means of communication which are often better than text files.

Re: Lua Script input and output

Posted: 18 Jun 2021, 15:09
by coppelia
Hello,

have also a look at sim.textEditorOpen and similar functions.

Cheers