lua-users home
lua-l archive

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


On Mon, Feb 16, 2009 at 8:00 PM, Wesley Smith <wesley.hoke@gmail.com> wrote:
>> The lua.exe wrapper
>> does, and you could add a "-O file" option to it to cause it to
>> freopen() stdout (and stderr).
>
> Have you tried this with a windows windowed application?  I've not
> been able to get any kind of stdout redirection on windows without
> generating a console within the app.  The console is not the most
> aesthetically pleasing nor flexible widget and I'd like to avoid it.

Happily, I haven't used windows in a dozen years, but I know its
console support is a hideous anachronism from DOS. Also, I'm a bit
confused about what you're trying to do, but I'm trying to help...

Your posted code indicated you think you have a FILE* that, if it was
used instead of STDOUT, would do what you want.

How were you going to get that FILE*? Weren't you going to fopen()
something? And why wouldn't you use freopen(), then?

If you want to embed lua in a windows application you would want to
avoid stdio and the console entirely, wouldn't you? And just define
print() to put stuff in some kind of scrolling text widget, or
whatever you prefer to the console?

Sam