• Advertisement
Sign in to follow this  

Lua - Overriding stdout

This topic is 3897 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
Sure. Just make your own print function.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
In the global table, exactly where you've put all the other C functions you've exposed to Lua so far.

Share this post


Link to post
Share on other sites
Quote:
Original post by jorelmb
Ohh! Now I get it, I always though this was done on the C API...

It is.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement