Re: Overloading __index and __newindex
Jason McKesson <[email protected]> Sun, 12 Feb 2012 10:20:00 -0800
| Newsgroups | gmane.comp.lang.lua.bind.user |
|---|---|
| Message-ID | <[email protected]> |
On 2/12/2012 9:27 AM, Teto wrote:
> I had worked on a function to do it. (just a quick hach). It seemed to
> work when I was testing it but I haven't used it in a long time.
>
> You may want to have a look/replace things:
>
> bool
> CLuaVM::setSpecialNewIndex(const char* class_name)
> {
>
>
> luabind::detail::class_registry* reg =
> detail::class_registry::get_registry( _vm );
> luabind::detail::class_rep* rep = reg->find_class(
> typeid(irr::SIrrlichtCreationParameters) );
> luabind::detail::class_rep* rep_audio = reg->find_class(
> typeid(audio::SAudioParameters) );
> // _INFO<< get_class_name( typeid(irr::SIrrlichtCreationParameters) );
>
>
>
> if(!rep){
> _LOG_WARNING<< "could not find a class rep for
> SIrrlichtCreationParameters";
> return false;
> }
> else {
> _INFO<< "found rep for class '"<< rep->name()<< "'";
> _INFO<< "registry: cpp_class"<< reg->cpp_class();
> _INFO<< "registry: cpp_instance"<< reg->cpp_instance();
> _INFO<< "registry: lua_instance"<< reg->lua_instance();
> _INFO<< "registry: lua_class"<< reg->lua_class();
> }
>
>
> if(!rep_audio)
> {
> _LOG_WARNING<< "could not find a class rep for
> SIrrlichtCreationParameters";
> return false;
> }
> else
> {
> _INFO<< "found rep for class '"<< rep_audio->name()<< "'";
> // _INFO<< "registry: cpp_class"<< rep_audio->cpp_class();
> // _INFO<< "registry: cpp_instance"<< rep_audio->cpp_instance();
> // _INFO<< "registry: lua_instance"<< rep_audio->lua_instance();
> // _INFO<< "registry: lua_class"<< rep_audio->lua_class();
> }
>
> int index = rep->metatable_ref();
> _INFO<< "class_rep: metatable_ref"<< rep->metatable_ref();
>
> // voici la cle utilise pour acceder au tableau representant la metatable
> lua_pushinteger( _vm, index );
> //Pushes onto the stack the value t[k], where t is the value at
> the given valid index and k is the value at the top of the stack.
> // Pushes on top of stack the metatable
> lua_gettable(_vm, LUA_REGISTRYINDEX);
> // Returns 1 if the value at the given acceptable index is a table,
> and 0 otherwise.
> //_INFO<< "Is table (should be table )"<< lua_istable( _vm, -1);
>
> lua_pushstring( _vm , "__newindex");
> // //class_rep::lua_settable_dispatcher
> lua_pushcclosure(_vm,&onNewIndex, 0);
> // set new index
> lua_rawset( _vm, -3);
>
>
> // pop le tableau /metatable
> lua_pop( _vm,1);
> return true;
> }
>
>
> As for luabind not being updated, something should definitely be done.
> Someone should contact the authors and ask to fork the project (don't
> know much about MIT license) and host the fork on our server: I would
> suggest Ryan Pavlik as the leader since he seems to be the most active
> guy on the ml. It could be hosted by www.tuxfamily.org (I know the
> guys here, it's top quality hosting)
>
>
> I am ready to help on luabind:
> -use variadic templates (when possible)
> -provide tostring functionality
> -capability to override __newindex and so on.
> -doxygen documentation
>
> I had begun the 4 previous tasks but without having a main repo to
> send modifs too, it was hard to gather motivation. I don't want to be
> leader of the fork since I am a self-taught programmer and as such,
> there are mechanisms which remain dark to me and I am afraid I
> wouldn't have time to dig deeper into this. But I am willing to lend a
> hand to work on a fork. If anyone interested ?
>
> Matt
There are already many forks of Luabind. Just look at the web of forks
over on Github: https://github.com/luabind/luabind/network. take_cheese
seems to be the one who's doing the most work on Luabind.
You don't have to "request" that you fork Luabind; you just do it. The
problem is that, with all of these forks and such, there's no notion of
a true, *official* version. There's nothing anyone is willing to stand
behind, to test and verify as being a "version" of the app, or anything
of the kind. There's just random source code on the net.
We don't need new hosting. What we need is for the owner to give the
*current* SourceForge hosting to the community so that we can start
making real distributions again.
> On Fri, Feb 10, 2012 at 5:20 PM, Jason McKesson<[email protected]> wrote:
>> On 2/9/2012 5:34 PM, Aaron Zinghini wrote:
>>> Hi,
>>>
>>> Following on from this archive:
>>>
>>> https://sourceforge.net/mailarchive/message.php?msg_id=24029568
>>>
>>> Is there any time frame when 1.0 will be released and the
>>> index/newindex overloading will be fixed?
>>>
>>> Thanks
>>>
>> Released by who? The main developers aren't updating it; it's been
>> almost a year and a half since 9.1; there have been 4 versions of Boost
>> released in that time. Their "solution" was to switch to a Git repo and
>> just give it to the community. If you want a version with more bug fixes
>> or features, you're going to have to walk through the various distinct
>> Luabind Git repos out there and cobble together a build out of them.
>>
>> In short, Luabind is pretty much abandonware at this point.
>>
>> ------------------------------------------------------------------------------
>> Virtualization& Cloud Management Using Capacity Planning
>> Cloud computing makes use of virtualization - but cloud computing
>> also focuses on allowing computing to be delivered as a service.
>> http://www.accelacomm.com/jaw/sfnl/114/51521223/
>> _______________________________________________
>> luabind-user mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/luabind-user
>
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/