Lua - Overriding stdout

Started by
4 comments, last by Sneftel 16 years, 10 months ago
Hi, I'm trying to embedd LUA with my application. However my application doesn't run a console so I can't see the results and everything. Is there a way to override where Lua prints, like to a ostream. That way I can use a stringstream or something to retrieve the output. I've searched over the forum and google and I don't seem to find a solution to this problem.
------------------------------"Carpe Diem!""Failure is the prequel of success"_.-:Jimbo:-._
Advertisement
Sure. Just make your own print function.
Quote:
Sure. Just make your own print function.


Sorry if this sounds newby but how do I override the other print? I mean like where do I put this new print function?
------------------------------"Carpe Diem!""Failure is the prequel of success"_.-:Jimbo:-._
In the global table, exactly where you've put all the other C functions you've exposed to Lua so far.
Ohh! Now I get it, I always though this was done on the C API...

:D Thanks!
------------------------------"Carpe Diem!""Failure is the prequel of success"_.-:Jimbo:-._
Quote:Original post by jorelmb
Ohh! Now I get it, I always though this was done on the C API...

It is.

This topic is closed to new replies.

Advertisement