lua-users home
lua-l archive

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


On Wed, Sep 7, 2011 at 9:05 AM, Guy J <desfenfe@gmail.com> wrote:
Hi Jose,

Thanks for your replay.
The method you suggested is too complicated for me and I do not wish to use any other external libraries...

Please find how I did it eventually - I guess it has a lot of problems because I'm in to Lua for 2 days now ;)

Any kind of feedback is appreciated!

Thanks,
Guy


SWIG (http://www.swig.org/Doc2.0/Lua.html) makes this easy. Combine with http://www.lua.org/pil/16.2.html for "deriving" a Lua object from a C++ object. 

Note that SWIG is not an external library; it takes metadata you give it about your lib and generates all the boilerplate code you need to export your C++ classes etc to Lua, do the type checking when you call your functions/methods from Lua, etc. Esp. useful if you are just starting. 

Oliver