lua-users home
lua-l archive

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


Thanks,
I did not think of doing it in Lua Code.
I was stuck with doing it in C.
DB
+++++++++++++++++++++++++++++++++
>> I wish to dynamically revector the Lua functions write, 
>> writeto, read and readfrom so that the original function
>> is called when not using stdin/stdout but calls my function
>> when using stdin/stdout.
>> 
>> Can anyone help?
>
>perhaps something along these lines? (out of my head, untested code)
>
>function write(...)
>  if type(arg[1]) == "userdata" then -- filehandles are userdata
>    call(write,arg)
>  else
>    call(mywrite,arg) -- or just do whatever you want here
>  end
>end