Re: Re: plua merged into lua
| From: | Johannes Schlüter | Date: | Tue, 16 Aug 2011 08:46:25 +0000 |
| Subject: | Re: Re: plua merged into lua | ||
| References: | 1 2 3 4 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-8462@lists.php.net to get a copy of this message | ||
On Tue, 2011-08-16 at 10:51 +0800, Laruence wrote:
> > In lua.c I do not understand why you need the LUA_G(instances) table.
> > The individual instances should be stored in the object (as is
> > lua_obj->L = L; ) and manged via that object.
> Doing this , is because I need to free a Resource when it was unset,
> and there must be a way to find out whether a
> Lua instance is valid, and since this is a Extension ineternal
> mechanism, so I prefer to use LUA_G
Why can't you free the lua stuff in the object's destructor? It is
created when the object is created and destroyed when the object is
destroyed.
When talking about creation and destruction of objects: what about
cloning? Will it survive $a = clone $a; ? I think it is ok to prevent
cloning by making the clone method private or such.
> > In lua.c I see that Lua::register seems to only accept global PHP
> > functions as a callback. Is there no way to attach custom data to the
> > lua closure, so we can store zend function pointers (as returned by the
> > "f" modifier to zend_parse_parameters) so object methods and closures
> > work, too?
> yes, but "f" is introduced after php 5.3. maybe I should use some
> macro tricky, and in fact array(obj, method) is accpected now, ;-)
Is there anything other than PHP 5.3 now? :-D
johannes