[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Windows console
- From: Nick.Trout@...
- Date: Tue, 23 Jun 1998 17:18:39 +0000
Hi Paul,
That sounds great could you mail it to please: nick.trout@psygnosis.co.uk
You have raised an interesting point there as well. Lua is designed as an
embedded language but the way it outputs text is not very convenient for
systems which can't trap the standard streams. ie. Windows (unless I'm
missing something). You have to go through the Lua code and alter every
printf, fprintf etc. to redirect the output to your buffer.
What about having a function: int lua_SendToOutput(FILE* stream, const
char *pBuffer, ...);
Then, all calls to printf in use this (ie. lua_SendToOutput(stdout,...) and
lua_SendToOutput(stderr, ...)). So, if you wanted to trap output you only
have to edit one function in lua to embed it properly in your code. And you
can grab the output of files if you want to check what they are writing....
I think this will work....?
printf("%d %d %d", 1,2,3);
becomes
lua_SendToOutput(stdout, "%d %d %d", 1,2,3);
fprintf(stderr, "%d %d %d", 1,2,3);
becomes
lua_SendToOutput(stderr, "%d %d %d", 1,2,3);
fprintf(myFile, "%d %d %d", 1,2,3);
becomes
lua_SendToOutput(myFile, "%d %d %d", 1,2,3);
void lua_SendToOutput(FILE* stream, char *fmt, ...)
{
char buff[500];
va_list argp;
va_start(argp, fmt);
vsprintf(buff, fmt, argp);
va_end(argp);
// This is Lua's default call which I can now edit to redirect the
output
// wherever I like.
fprintf(stream, buff);
}
e.g. I could alter fprintf(stream, buff); to
SendOutputToMyConsole("buff");
(This sends everything, including files, to my console window).
Nick.
Paul Bleisch <pbleisch@home.chat.net> on 23/06/98 03:53:15 PM
Please respond to lua-l@tecgraf.puc-rio.br
To: Multiple recipients of list <lua-l@tecgraf.puc-rio.br>
cc: (bcc: Nick Trout/UK/PSYGNOSIS)
Subject: Re: Windows console
Hi Nick,
I have one that is just about ready. It is very basic. You can
drag-n-drop
files on it and it will do_file() them. (Optionally resetting the
environement
between files.) There is a single input field for testing things.
As soon as I hook up a Lua print() facility to output to the console it
will be usable. By default it builds against tklua (no GL) and the
standard
lua library.
It is called WinLua or salt (stupid-ass-lua-tool).
Let me know if this will work for ya.
Paul
On Tue, Jun 23, 1998 at 05:53:51AM -0300, Nick.Trout@psygnosis.co.uk wrote:
>
> Has anyone written a nice Lua Windows console (as opposed to having to
use
> a DOS prompt) which they would be willing to post on here or point me to
a
> URL?
>
> i.e. like the WinPython thing....
>
> :-)
>
> Ta,
> Nick.
>
>
>