[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: Type definition within LUA
- From: Yann Com-Nougue <ycomnougue@...>
- Date: Wed, 9 Jun 2004 10:03:03 -0400
We have a mechanism doing this in our app. Basically
RegisterClass() stores a reference to the object that is registered. And
when we want to "instanciate" the object we simply clone it. Clone : We
make a real ( not reference) copy of all the data and a reference copy to
So basically your factory stores a copy of your "lua class". And
has a creation function. When the function is called the factory clones the
registered "lua class" and returns the new instance.
This is a pretty basic creation pattern, but of course I can't
remember it's name :)
[mailto:email@example.com] On Behalf Of Dan East
Sent: 9 juin 2004 09:42
To: Lua list
Subject: Type definition within LUA
Hi. I wish to allow the user to define classes within LUA that can be
instantiated from the host app (written in C of course).
Something along this line:
The host application can then create as many instances of that object as
desired within the LUA environment, where each instance's data will be
I am currently using lunar to interface my C++ classes with good success,
but I need to allow class-like definitions within LUA as well.