[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Lua C Functions in C++ class
- From: "Joshua Jensen" <jjensen@...>
- Date: Tue, 21 Oct 2003 17:34:08 -0600
Upvalues are fine, but they are hackish when all you want to do is directly
call a C++ member function. If your requirements allow you to work in a
modified Lua distribution, consider this:
http://lua-users.org/lists/lua-l/2002-04/msg00108.html
The functor extension described above allows you to directly register and
call C++ member functions.
An even better mechanism is available in the C++ LuaPlus distribution
(http://wwhiz.com/LuaPlus/index.html). Not only can LuaPlus's approach call
lua_State* enabled member functions, it can also call many C++ member
functions directly that don't even require a lua_State*. On the negative
side, it also modified Lua to work much more efficiently.
If you simply can't modify Lua and can stand longer compile times, consider
LuaBind (http://luabind.sourceforge.net). It does some amazing things.
Josh
> -----Original Message-----
> From: lua-bounces@bazar2.conectiva.com.br
> [mailto:lua-bounces@bazar2.conectiva.com.br] On Behalf Of Tim Conkling
> Sent: Tuesday, October 21, 2003 3:50 PM
> To: Lua list
> Subject: Re: Lua C Functions in C++ class
>
> Thanks a lot to everyone who replied. Userdata upvalues are
> exactly what I need.
>
> Tim
>
> On Oct 21, 2003, at 2:57 PM, Luiz Henrique de Figueiredo wrote:
>
> >> there's no way to associate any sort of user data with the
> exported
> >> functions
> >
> > Sure there is. You export C closures, not C functions, in
> fact. So C
> > function can have upvalues.
> > --lhf
> >
>
>