Jump to content
  • Advertisement
Sign in to follow this  
jorelmb

Lua - Overriding stdout

This topic is 4164 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
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
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!