lua-users home
lua-l archive

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

> >1) malloc vs newuserdata
> I don't know for sure the answers to most of your questions, 
> but one point is: If you're encapsulating a C++ object in a 
> user data type, you need to use the "malloc" method (an 
> operator new, in that case).

Doing a C++ non-placement new works fine.  You just have to:

1) Use lua_newuserdatabox().
2) Possibly provide a gc tag, depending on how and when you want your
C++ object freed.