lua-users home
lua-l archive

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


Marc Balmer wrote:
Now I want to somehow store C data in these objects, or link them with
such information.

E.g. I have to store the Widget pointer (a C lightuserdata value) for
each widget represented in the hierarchy.

What is a good way to do this?  My adventourous approach at the moment
is to create an additional table when an object is created, store my
values in this additional table and add it as metatable to the created
object...

You may hide the objects in closures. No way to access the object.

http://lua-users.org/wiki/ObjectOrientationClosureApproach

HTH

Peter