lua-users home
lua-l archive

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


>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