View Single Post
Old 11-03-2009, 05:33 AM   #100
hansel
JSR FFD2
hansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheese
 
hansel's Avatar
 
Posts: 305
Karma: 1045
Join Date: Aug 2008
Location: Rotterdam, Netherlands, Europe, Sol 3
Device: iliad
Quote:
Originally Posted by ericshliao View Post
It seems that tolua++ is a fork of tolua.
What is the use case of of tolua (or tolua++)? I don't understand. Suppose I have some lib written in C, then can I use tolua to generate lua binding for the lib?
Yes and no . Basically you have to
  1. write a file that decribes the functions you wand to be available in Lua (this looks very much like a C include file)
  2. use tolua++ to generate C file (this handles the interface betwwen C and Lua)
  3. compile and link this C file (+ your own code if you want) to a Lua module (a .so file).
This is easy for simple C libraries, and quite some work for C++ libs with lots of classes and types. If you google around, you will find some examples.
If I have some spare time (and no projects that are more fun ) I wil use tolua++ to do a Lua binding for some Iliad libraries...


Quote:
Originally Posted by ericshliao View Post
I want to use libxml2 with lua, and currently I only found lua binding for the part of xmlreader of libxml2 (http://asbradbury.org/projects/lua-xmlreader/). I need xmltree part. Can I use tolua to generate lua binding automatically?
Any interesting project in the pipeline? Depending on your needs, you might:
Have fun!

Last edited by hansel; 11-03-2009 at 05:48 AM.
hansel is offline   Reply With Quote