mlua-rs / rlua

High level Lua bindings to Rust
Other
1.73k stars 115 forks source link

Capturing stdout #250

Closed makspll closed 2 years ago

makspll commented 2 years ago

I want to capture and forward the standard output of Lua scripts and forward it to a console internal to the application, does Rlua support this functionality in any way currently ?

jugglerchris commented 2 years ago

There's nothing rlua-specific, but at the Lua level you can replace the global print function (and if needed io.write) to send output elsewhere before running the script.

makspll commented 2 years ago

That sounds reasonable, thanks!