lua-users home
lua-l archive

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



>-----Original Message-----
>From: Ando Sonenblick [mailto:ando@spritec.com]
>Sent: Wednesday, April 28, 2004 6:27 PM
>To: Lua list
>Subject: C++/Lua oop gotcha...
>
[skipped]
>Definitely a pretty nasty corner I painted myself into.   It's 
>too late 
>to change now (and it all works well so far), but had I this insight I 
>probably would have just had my C++ objects have a table representing 
>them with what's currently in the userdata memory directly in 
>the table 
>(it's only a ptr to the actual C++ object)...
>

Yep, this is how I have done it. As a general principal Lua table of every object that has C++ part for it maintains a pointer to a C++ object in this table. All the functions and properties exposed from C++ to Lua are accessed via that pointer. 

>ando "wish I had Programming in Lua before I dove in" sonenblick
>-----------------------
>Ando Sonenblick
>SpriTec Software
>www.spritec.com
>
>
>