Closed pakozm closed 9 years ago
A new branch, related with commit d2971583b80016e7a9cc829875c5f44d193bd05d , implements this solution. Point (3) has been solved as stated above, only allowing to change metatable when casting from base class to derived class, leaving the metatable untouched in the rest of cases. It is safe to convert in this way because of the simple inheritance method implemented in APRIL-ANN classes. I propose to merge this branch as soon as possible, in order to test in devel release. I have performed tests and debug solving minor technical problems and mistakes introduced in the implementation, and it seems pretty clean now.
Done
Currently, when we push a C++ object into Lua, a userdata is allocated to wrap the C++ pointer. Calls to methods which return the caller object end into unnecessary allocations of multiple Lua userdata. It is possible to alleviate this problem using luaL_ref when pushing objects and storing this reference into Referenced class, allowing to retrieve the same reference when it would be required. Some considerations about this approach are: