redirect Lua output into CEGUI

Create issue
Issue #914 new
Former user created an issue

Automatic migration. Original reporter: "DEvil HUnter"

redirect Lua output into CEGUI for easy passing around and manipulation.

Example Problem/Idea behind: you create a "in game/developer" console just like a lua bash in your running game. (this is a nice way to manipulate your game at runtime without restarting or recompiling) but then you want to see the output of lua interpreter printed in a text box (history window or what ever). if you make a typo the app should not crash so we need a other error handling and maybe we want to print the error description in a different window.

Implementation suggestion: 1. take the lua output and redirect it to the event system of cegui. then you should get a event for every new line added to the output. 2. do the "same" with errors. you could use the error messages you would throw otherwise and give it as a new line event for error output. 3. (nearly) all scripting stuff is in try/catch but it re-throws cegui errors then. this behavior is maybe not intended by the user. i suggest a switch whether to throw cegui error then or just log it and do normal job. second suggestion register event or callback on errors so you can decide from there what to do. (4. history windows or such should directly be able to subscribe to output events so you can redirect the lua output direct to a cegui window with xml.)

Reproducibility: N/A

Additional information: i solved this by overriding the print function in lua. the new print function now writes it to the window. maybe there is a better way. i think doing it direct in c++ would be better.

Comments (0)

  1. Log in to comment