[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Polymorphic luaL_checkudata?
- From: "Mark Edgar" <medgar123@...>
- Date: Sun, 15 Apr 2007 19:09:38 -0700
I suppose I could be more specific and more helpful:
liolib.c needs to call pclose() instead of fclose() when the
file:close() metamethod is called. This is handled by aux_close:
The __close field is stored in the environment of each popen'ed
userdatum. This is done automatically because popen'ed userdata are
created only in io_popen() whose environment table is set explicitly
Similarly, you could set an environment table on your function which
creates pipe userdata. Your get/set_timeout metamethods could use the
presense of this environment table (or a certain field contained in
it) to determine if a given userdata is indeed a pipe or something
Note that if you want APR pipes to have the same semantics as
io.popen'ed pipes, then most of this work is already done for you ...