Solved. Re: Fwd: Inspecting objects
Thomas Nelson <[email protected]>
| Newsgroups | gmane.comp.lang.lua.bind.user |
|---|---|
| Message-ID | <[email protected]> |
Solved... My bad. It turns out it had to do with how I was exporting
the object... turns out it's helpful to wait till after you've created
the instance before you inject a back ref.
Any interest on the list for a patch with the following enhancements:
1) Export a luabind::wrap_base derived object to an arbitrary
table/namespace in the lua from C++
2) Allow methods to be overridden on a per instance basis
3) Examine an object from C++ to determine if a method has been defined
on an instance.
todos
1) When exporting via item 1, allow the programmer to specify a lua class.
Right now you can only specify a C++ class that has been exported via
luabind. I want to be able to export as a class that has been derived
on the lua side.
2) There are some problems with the function over rides that seem to be
based pretty deeply in how lua handles method calls with a self.
so defining:
function MainMenu:OnMenu(args)
print("boo");
end
works, however
function foo(self, args)
print ("ack");
end
MainMenu.OnMenu = foo;
breaks.
On 3/18/2010 9:27 AM, Thomas Nelson wrote:
> Ok... Here is what I'm seeing
>
> When I access the object from the lua side I'm getting one env table,
> coming in from C++ gives me a different one. So if I set a property on
> the Lua side the value is stored in the first table and is not visible
> when I inspect the second (C++ visible) table.
>
> One item that I left out of my description yesterday is that these are
> smart pointer protected objects. Is it possible the lua side is
> accessing an env attached to the smart pointer/holder rather than the
> object itself?
>
> Thoughts? inspirations? epiphanies?
>
> TomN
>
> On 3/17/2010 9:30 AM, Thomas Nelson wrote:
>
>> I am very sorry if this goes out twice, I sent it out yesterday and I've
>> not seen it come back to me on the list or show up in the archives so
>> I'm guessing something went wrong at my end.
>>
>> I am trying to add some introspection to my luabind objects and I am
>> starting to suspect that I'm missing something obvious.
>>
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev