Lua Script input and output

Typically: "How do I... ", "How can I... " questions
Post Reply
zhy149
Posts: 132
Joined: 14 Apr 2021, 20:18

Lua Script input and output

Post 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!

fferri
Posts: 1193
Joined: 09 Sep 2013, 19:28

Re: Lua Script input and output

Post 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.

coppelia
Site Admin
Posts: 10336
Joined: 14 Dec 2012, 00:25

Re: Lua Script input and output

Post by coppelia »

Hello,

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

Cheers

Post Reply