Git Product home page Git Product logo

Comments (13)

danomatika avatar danomatika commented on September 27, 2024 1

I have SWIG working with ofxLua now: check the swig branch. It's planned to become the new master and now works with the ProjectGenerator.

Also, if you're into SWIG, I spun out the interface for the OF API into a separate repo: https://github.com/danomatika/swig-openframeworks

from ofxlua.

danomatika avatar danomatika commented on September 27, 2024

I'm not sure I understand. SWIG generates language bindings for C/C++ libraries through a separate build step. Luabind does this through templating at runtime so we already have this.

I agree I'd like to drop Boost which means dropping Luabind at some point, but so far Luabind is the easiest Lua binding library to use around .. once you have it linking in your project that is.

ofxLUA is not intended to be "OF in lua" but more of a wrapper for Luabind to make that and other custom things possible. You can make a feature complete OF wrapper with it if you want.

from ofxlua.

danomatika avatar danomatika commented on September 27, 2024

In looking into SWIG more I think it could be a good method to replace Luabind. Instead of writing a Luabind header you write a SWIG module file.

I can tell from first hand experience that writing the headers by hand is a pain. I have most of OF already wrapped here: https://github.com/danomatika/robotcowboy/tree/master/src/bindings and it took forever.

I'll look into it when I return to that project. Luabind is definitely a huge beast ... boost as well.

from ofxlua.

danomatika avatar danomatika commented on September 27, 2024

For reference: SWIG and Lua manual

from ofxlua.

arthursw avatar arthursw commented on September 27, 2024

Thanks for your answers !
Yes wrapping everything by hand takes forever ! That's why I was wondering if there is an automatic solution (a tool which reads the c++ headers and generate the wrappers automatically). I think SWIG can do that, maybe LuaBind as well, I didn't try anything yet to be honest ;-) I just played with your nice ofxLua and it's great !

I saw http://vimeo.com/9243889 by the way, great style !! I love it ;-)

from ofxlua.

danomatika avatar danomatika commented on September 27, 2024

Well both Luabind and SWIG do most of the wrapping but you still need to specify what you want wrapped. Even doing that for a larger api takes time, either way.

from ofxlua.

danomatika avatar danomatika commented on September 27, 2024

I gave SWIG the cold college try, but it can't handle some things that Luabind does automatically. That work is sitting in the swig branch: https://github.com/danomatika/ofxLua/tree/swig

After that didn't work out, I decided to port the OF wrapper I had from an earlier stalled project and now we have an almost full set of bindings for OF in ofxLua. Oh well, bite the bullet sometimes.

from ofxlua.

arthurmasson avatar arthurmasson commented on September 27, 2024

Wouaw I saw that you recenty updated your project, and I just looked at all the bindings you added, that's insane! Great work, thanks a lot!

Did you really make everything by hand, or you made some ruby scripts helper?

Now I had two problems when I used lua:

  1. there is no binding for stdlib by default! I've seen that there are some things like that here http://lua-users.org/wiki/LuaAddonsArchive but not really standard and well documented,
  2. there is no standard way to do a lua class,

How do you solve those problems?

from ofxlua.

danomatika avatar danomatika commented on September 27, 2024

I didn't solve them. That's why I went back to Luabind which does. :P

from ofxlua.

arthurmasson avatar arthurmasson commented on September 27, 2024

Oh yes, I just read http://www.rasterbar.com/products/luabind/docs.html and saw that Luabind provides classes! Nice! What about std lib data structures (map, set, queues, etc.)?

from ofxlua.

danomatika avatar danomatika commented on September 27, 2024

Actually the stl containers work I think, you just have to explicitly overload them: http://stackoverflow.com/questions/3624306/msvc-10-luabind-stdvector-refuse-to-compile Naturally, it's not a direct conversion to a lua table ... but that could be possible via the Lua api.

Also, one of the example scripts uses the Luabind class in lua: https://github.com/danomatika/ofxLua/blob/master/example/bin/data/scripts/polygonExample.lua#L2

from ofxlua.

arthurmasson avatar arthurmasson commented on September 27, 2024

Thanks a lot! I'll have a closer look soon! 👍

from ofxlua.

danomatika avatar danomatika commented on September 27, 2024

Also to note:

  1. SWIG can wrap the stl classes
  2. I have class support working in ofxLua using SWIG by using a class function from the Lua wiki, see https://github.com/danomatika/ofxLua/tree/swig#classes. It doesn't allow you to inherit C++ classes, but I think that's a decent tradeoff for not requiring Boost, keeping track of Luabind changes, and much easier distribution of the generated .cpp bindings.

from ofxlua.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.