lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi list,
In our application, we have a console window that is supposed to
display stdout and stderr.  Essentially, information generated from
print(), error() and luaL_error is meant to go to this window.  It's
pretty straightforward to make this happen on OSX and Linux because
you can redirecet the output streams, but on Windows it's a bit of a
nightmare since a Windows windowed app doesn't have such output
streams unless you call AllocConsole().  I'm able to redirect stout et
al to this console windows but I don't really want it to go there.
Instead, I want it to go to the application's window like I'm able to
do on other platforms.

Given this info, I'm wondering what the best approach is to making the
user's experience as consistent across platforms.  I'd really like to
not have the MSDOS type console if possible.  The only approach I can
think of to do this is to replace the standard Lua functions print()
and error() with custom functions that print to the appropriate
window.  I'll also need to modify where luaL_error output goes, but
I'm not sure how to do that (preferably without modifying Lua source
code).  I would be satisfied with these 3 functions going to the app
window even though printf etc. would not.  Ideally it would, but from
all of the windows documentation and tutorials I've read, I don't
think it's possible.

Any ideas, comments, etc. greatly appreciated.  Windows is not my
usual platform, so I'm still trying to figure out how to do this while
meeting the expectations of people who do.

thanks,
wes