I'm trying to redirect stdout in Lua (5.1) to a file instead of to console.
There is a third-party API (which I cannot modify) containing a function that prints out a serialized set of data (I do not know which function does the printing, assume some sort of print())
This data is far too verbose to fit on the screen I have to work with (which cannot be scrolled) so I want to have the function's output be directed to a file instead of to console.
I do not have the ability to patch or manipulate Lua versions.
My thought was to change stdout to a file using the poorly documented io.output() file, but this does not seem to work at all.
io.output("foo") -- creates file "foo", should set stdout to "foo"?
print("testing. 1, 2, 3") -- should print into "foo", goes to console instead
Does anyone know of any way to force a functions output into a file, or force all stdout into a file instead of console? TIA.