RE: Implicit casting issues when binding to C++

  • From: "Janis Britals" <jbritals@xxxxxxxxx>
  • To: <luajit@xxxxxxxxxxxxx>
  • Date: Wed, 11 Jul 2012 19:46:28 +0200

Mike Pall wrote:

> I'd rather implement proper handling for derived classes 
> (well, structs in C parser mode) including the vtable issue. 
> That would also allow declaring and calling regular, static 
> or virtual methods.

That would be awesome! Currently I'm using explicit method "declarations" in
Lua that also specify "const" and "static" attributes ("virtual" too, but
for different purposes), so that I can look up the right method in exports
table and properly set up arguments.

> Automatic conversions to a base class (with pointer offsets) 
> would work, too. Multiple inheritance should be doable, but I 
> hope you don't need virtual base classes?

That's exactly the right mix. Some of most popular libraries do use multiple
inheritance (Qt quite heavily), but I haven't come across any use of virtual
base classes.

> I'm tempted to invest a couple hours into this and see how 
> far I get. No promises -- I really don't know if this works out.

I'm very very curious ...

BTW, what do you think of the __tonumber metamethod I mentioned in my last
post? That would go a long way towards sorting the enum mess.

-- Janis

Other related posts: