Trapping _OUTPUT

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Trapping _OUTPUT

William Leshner
Hi. I'm wondering what the best way to trap writes to _OUTPUT would be. I don't want to just redirect output, I want to do something entirely different. I could, I suppose, just modify io_write, but I really don't want to do it that way.

Thanks for any help.

Reply | Threaded
Open this post in threaded view
|

Unicode Support

Erik Hougaard
Quick Question to the list:

Has anyone created a version of Lua that uses wide characters/unicode
thru-out the system ?

/Erik



Reply | Threaded
Open this post in threaded view
|

Re: Unicode Support

Reuben Thomas-3
> Has anyone created a version of Lua that uses wide characters/unicode
> thru-out the system ?

Suggestion: make this work in the same way as Lua_number, i.e. the character
type should be a #define. Admittedly it's rather more involved with
characters, because different functions must be used for wide characters, so
these all have to be #defined too. In practice, I suppose you either want to
use char or wchar (or whatever it's called).

-- 
http://sc3d.org/rrt/ | free, a.  already paid for (Peyton Jones)


Reply | Threaded
Open this post in threaded view
|

Re: Trapping _OUTPUT

Luiz Henrique de Figueiredo
In reply to this post by William Leshner
>Hi. I'm wondering what the best way to trap writes to _OUTPUT would be. I don't want to just redirect output, I want to do something entirely different. I could, I suppose, just modify io_write, but I really don't want to do it that way.

How about redefining "write":

 function write(...)
  if arg[1]==_OUTPUT or tag(arg[1])~=tag(_OUTPUT) then
   -- do something entirely different...
  else
   call(%write,arg)
  end
 end

--lhf

Reply | Threaded
Open this post in threaded view
|

Re: Trapping _OUTPUT

William Leshner
Thanks. That is a good idea. Maybe that is what I will do. By the way, what
I am doing is making a Lua plugin for REALbasic such that you can call
scripts from within a REALbasic app. I whipped up a quick app that opens
scripts as text files and being able to execute them. I have a console
window that gets the output. I modified print() to capture that output but
write is a bit trickier. I think I have another solution that will also work
but I could easily implement your solution (I'll need to register some
function that will callback to REALbasic that I will call from write()).

> From: Luiz Henrique de Figueiredo <[hidden email]>
> Reply-To: [hidden email]
> Date: Fri, 5 Jan 2001 08:55:48 -0200 (EDT)
> To: Multiple recipients of list <[hidden email]>
> Subject: Re: Trapping _OUTPUT
> 
>> Hi. I'm wondering what the best way to trap writes to _OUTPUT would be. I
>> don't want to just redirect output, I want to do something entirely
>> different. I could, I suppose, just modify io_write, but I really don't want
>> to do it that way.
> 
> How about redefining "write":
> 
> function write(...)
> if arg[1]==_OUTPUT or tag(arg[1])~=tag(_OUTPUT) then
> -- do something entirely different...
> else
> call(%write,arg)
> end
> end
> 
> --lhf
>