Lua5 IO Library

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Lua5 IO Library

D Burgess
I am reposting the question because I suspect it got lost
in the LuaCheia avalanche.

Summary
-------
 In Lua4 parlance, where we have _STDIN, _STDOUT, _STDERR 
 and _ALERT(a function). Could we have _STDINFUNC, 
 _STDOUTFUNC and _STDERRFUNC ?

Detail
------

Is there a way that the new IO Library can be used to
dynamically revector calls that read/write/flush to
stdin/stderr/stdout? The requirement is for FastCGI,
MSWindows GUI Windows, Windows Pipes etc.

The stdin/stderr/stdout may not be FILE* handles.
The io.read()/write() and print() need to adapt
dynamically.

 if running as a Windows GUI app then
    io.stdout = pointer to a structure containing a windows handle
    io.write() is different function

 else running as a FastCGI app then    
    io.stdout = pointer to a FastCGI structure
    io.write() is different function

iolib provides file handles as accessible objects, could we
please have globally accessible lua_cfunctions for the stdout/
stderr/stdin io?

In Lua4 parlance, where we hav _STDIN, _STDOUT, _STDERR and
_ALERT. Could we have _STDINFUNC, _STDOUTFUNC and _STDERRFUNC ?

In other words make io.read(), write() with std handles
dynamically replaceable just like print().

PS.