lua-users home
lua-l archive

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



I ended up doing our own binding (not open source, at least for now - sorry).

One of the benefits it has is integration of C++ 'new' operation with Lua object lifespan control. So doing

	new(L) MyClass( anything );

..calls the 'MyClass' constructor (of any type) but allocates the object in the Lua gc'ed memory area.

If there is a publically available C++/Lua binding library using the same mechanism, I'd be glad to know (it would be better to use a public library for the binding - or maybe I should push the customer to open up that part of the code?).

btw, 'MyClass' needs to derive from 'LuaObject', if anyone starts wondering how the above could ever work.

I would warn you about SWIG - imho it's way too complex for the job at hand (when Lua is concerned). I've tried to like it twice, and failed both times. :/

-asko


Martin C. Martin kirjoitti 9.12.2009 kello 5:45:

Hi,

What libraries would someone recommend for binding Lua to parts of a large, existing C++ code base? It needs to work in both Windows and Linux. I'm looking at LuaPlus (I know, it's a lot more than just a C ++ binding), but perhaps that's not the place to start?

The "Lua C API" page at:

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

mentions 11 projects; which ones would people suggest I try first, and are there any that are abandoned or superseded or should otherwise be left until later?

Best,
Martin