On Sun, Oct 26, 2008 at 10:52 AM, klaas.holwerda <[EMAIL PROTECTED]> wrote: > Hi John, > > The index operator almost works. > The line: > a2dLayerInfo* returns = new a2dLayerInfo((*self)[(indx)]); > should become this: > a2dLayerInfo* returns = new a2dLayerInfo(*(*self)[(indx)]); > > The copy constructor needs a reference, while my inde operator return a > pointer. > If it would return a reference it would be oke. So maybe in other cases > it might be oke. > > Here the binding code: > > %include "canvas/include/layerinf.h" > %class %noclassinfo a2dLayers, a2dCanvasObject > a2dLayers() > a2dLayers( const a2dLayers& other, a2dObject::CloneOptions options = > a2dObject::clone_deep ) > %operator a2dLayerInfo* operator[] (int indx) > %operator const a2dLayerInfo* operator[] (int indx) const >
I changed it so that it does not create a "new" instance of the returned pointer and try to run the copy constructor on it, but rather it just pushes the pointer to the object into Lua. This means that the object must exist for the life of any Lua calls to it. Hope it works now. -John ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ wxlua-users mailing list wxlua-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxlua-users