I created a lua module with a very large number of wrapped C++ classes using swig. The wrappers are generated and compiled (with -Wall) without any issues. However, in a couple of places that I've found, I run into the following issue: basic assignment of member data fails.
If I run:
Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio
> require('myModule')
> a = myModule.ClassA()
I can then verify that the metatable attached to "a" contains all of its member data (in this case fields "b" and "c", of class type ClassB and ClassC respectively.)
I can further do:
> a.b = myModule.ClassB()
which reassigns b to a new instance of ClassB() successfully. However, when I go to do:
> a.b.c = myModule.ClassC()
I receive the error message:
Error in ClassB_c_set (arg 2), expected 'ClassC *' got 'ClassB *'
As though the expression on the right side of the '=' was an object of the same type as the element containing the data field to be reassigned. I'm sure I must be missing something simple, but I've been banging my head against the wall for a few hours now to no avail.
Anybody have any thoughts? Thanks!