[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: C++ member function
- From: Nikos K Gorogiannis <N.K.Gorogiannis@...>
- Date: Wed, 14 Mar 2001 12:03:53 +0000
Charlie Goff wrote:
> how does one register a member function into the lua environment? like in
> the constructor, for example?
Well, the Lua API allows you to register only C functions, so what you
ask cannot be done directly. You need to provide a (C function) callback
for each member function you want to bind and register that as the
appropriate tag method for your object.
Lots of ways to do that!:
- let tolua do it for you
- write the callbacks by hand
- use templates to produce them for you. (For an example on how to do
the latter, see the non-tolua package at the Addons page)
- use lua-swig (or is it swig-lua?) to do similar things with tolua
(YMMV)
Nikos