lua-users home
lua-l archive

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


>From my own experiences i've found using tolua's built in parsing to work
much better than using separate pkg files. I find it much much easier
maintaining your header files with some ToLUA commends than to remember to
maintain another tolua package file.  Especially once the project gets quite
large.

Thomas


----------------
> 3. How would I create a package file for toLua? Should I edit
> my source code
> to comply for this, or will toLua just automatically generate
> it from my
> source code? If this is so, what should I do then?

The quickest way is just to copy your C++ interface/header file and make a
.pkg file. Simplify it down to what you want Lua to be able to see. toLua
takes no notice of access, ie. public and private so you have to remove all
the private stuff. Its really not that much hassle to keep it up to date
with your source code. I tried adding comments to my interface files and
writing a script to parse and generate a package file automatically but your
C++ code turns into a mess and by the time you've done it you might as well
hand code the package file.

If you need an example of toLua packaging and how to structure Lua and toLua
have a look at http://doris.sf.net/ Theres a binding to OpenGL, GLUT, GLUI
and my C++ classes using toLua. There is also some OpenGL samples in Lua.
(There are more examples in CVS). It contains all the VC6 projects and *nix
makefiles and also how to include compiled Lua in your code so you can hide
source or save distributing Lua files with your exe.