lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On 05/12/2011 12.32, steve donovan wrote:
That's the rub. I pity the poor bastards who have to bind to C++.

I, er, 'solved' the problem by going through C when calling C++ from Lua, passing back an object identifier previously received from C++.

It could be slower (it wasn't in my simple case), but I prefer not to keep C++ pointers on the Lua side unless I have no choice; I also try to decouple the two sides from each other as much as possible. I consider decoupling a very important factor in code robustness and I think (generally speaking) that making C++ class members directly accessible from Lua would be looking for trouble.

So I made C++ (actually, the C dispatcher) ony accessible from Lua through a dedicated API, and did the same on the Lua side.