not-tolua

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

not-tolua

Nikos K Gorogiannis
Hi,

This is to `announce' not-tolua, some C++ header files for Lua 4.0, that
attempt to provide similar functionality (but see below) with tolua,
without using anything else than C++ templates and macros (not even lua
code).

In other words what it does is, with your help, exposes the classes
you've already defined to Lua code, without requiring any modifications
to your classes. 

Currently functionality includes:
* member variables (lua callbacks automatically generated for ground
types or 
  classes)
* methods
* single inheritance
* constructors with table arguments that set member vars
* destructors

Missing functionality:
* proper type checking in Lua (inheritance breaks it)
* multiple inheritance (not sure if it's any good though)
* objects always must be default constructible
* garbage collection

Find it at the Lua site in the addons section. Documentation is null,
but an example is included and if anyone is interested I'll be happy to
answer questions/improve the code/add docs.

Cheers,
Nikos

Reply | Threaded
Open this post in threaded view
|

Re: not-tolua

Lenny Palozzi-4
On Thu, Feb 15, 2001 at 03:27:37PM +0000, Nikos K Gorogiannis wrote:
> 
> Missing functionality:
> * proper type checking in Lua (inheritance breaks it)
> * multiple inheritance (not sure if it's any good though)
> * objects always must be default constructible
> * garbage collection

No garbage collection? Attach a userdata object(your T*) as a hidden item in
the Lua table, associate a new tag value to the userdata, add a "gc" tag
method for that tag to your destructor_callback function. 

Lua will gc your table when it goes out of scope or there are no 
references to it. The gc runs into your userdata object and will call your
destructor_callback which deletes the object.

See my Luna code.

-Lenny.

Reply | Threaded
Open this post in threaded view
|

Re: not-tolua

Lenny Palozzi-4
On Thu, Feb 15, 2001 at 11:56:55AM -0500, Lenny Palozzi wrote:
> 
> No garbage collection? Attach a userdata object(your T*) as a hidden item in
> the Lua table, associate a new tag value to the userdata, add a "gc" tag
> method for that tag to your destructor_callback function. 

Actually, you're not using tables but a plain userdata object, but you get
the idea.

-Lenny