Page 1 of 1

cut 'n paste from linux lua console

Posted: Tue Apr 26, 2005 11:08 pm
by jorgy
Subject says it all - it would be nice to be able to select text from the lua console to paste into other apps. Thanks!!

Posted: Wed Apr 27, 2005 1:48 am
by 7feet
Two things you can do (from inside the script).

First, a simple line of "io.output(path)" (you pick the path of course) should redirect the standard output (which here is the console) to the file of you're choice. I haven't tried it, but that's the way it's supposed to work. But then you won't see the result in the console.

The other is to open a file and then mirror the print functions with write functions:

Code: Select all

outputPath = "c:\\moho\\scripts\\outputfile.txt" - windows format - whatever you like
local file = io.open(outputPath, "w") -- or "a+" to add to the end of existing file
...
	print(result)
	outputFile:io.write(result)
...
Not quite the same as cut and paste from the console, which I wouldn't mind and have wanted to use before, but it'll get you by for now.