lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 23.03.2010 08:44, Valerio Schiavoni wrote:
> hello,
> i execute a command-line program via popen. This command can receive
> input from stdin or from a file.
> The input parameter in my case is a string. Currently, I wrote the
> string on a temp file, and I specify the name
> of the file as a parameter to the command given to popen.
> 
> Do you know if it's possible to play with stdin so that the string is
> set as the current stdin, so that I avoid to write on disk ?

Just use pipes:

$ echo "Long string"|lua -e 'print("String:", io.read("*a"))'

Regards,
miko