lua-users home
lua-l archive

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


On Wed, Jun 22, 2011 at 10:52 AM, Jerome Vuarand
<jerome.vuarand@gmail.com> wrote:
> The API of the file objects is clearly defined in the manual, you can
> implement a new function io.open that would return your own userdata
> (or a table) with the right methods.

This is true, and it's the approach I took for a SciTE extension that
needed a robust popen. But it involves copying most of liolib.c, which
seems like overkill.  The suggested io.fdopen() would allow you to
pass your own open file handle (with an optional cleanup function?)
and let the existing io functionality do the rest.

As for undocumented, well this is exactly the point: continuing to
cast to FILE** can be a problem.

steve d.