Page 1 of 1
Lua C++ connection
Posted: Sat Aug 06, 2016 10:45 am
by Julinator
Hello Lovers,
I've been working on a few games with LÖVE and I'm a big fan of the framework. I also like the simplicity and possibilities of the framework, but I was wondering where the link between the lua functions and the functions in C++ is, so I can learn more about LÖVE and C++. This could be useful if I want to extend LÖVE to support Bluetooth on Android for example.
Re: Lua C++ connection
Posted: Sat Aug 06, 2016 4:17 pm
by bobbyjones
https://bitbucket.org/rude/love this is the source code for love. Also if you plan to extend love join irc and check with the devs to see if what you doing is something they would like to merge in. They might be able to give you pointers as well.
Also you might be able to write a lua side library utilizing the lua jni wrapper bartbes made. The only thing you would have to do is build an apk with the correct permissions in order for bluetooth to work.
https://bitbucket.org/bartbes/jniwrap
Re: Lua C++ connection
Posted: Sun Aug 07, 2016 8:33 am
by Julinator
bobbyjones wrote:https://bitbucket.org/rude/love this is the source code for love. Also if you plan to extend love join irc and check with the devs to see if what you doing is something they would like to merge in. They might be able to give you pointers as well.
Thanks, but I still don't understand how the API in Lua calls the specific functions in C++. Which part of the source code is responsible for that?
Re: Lua C++ connection
Posted: Sun Aug 07, 2016 11:54 am
by bobbyjones
In the love source there are files for each module called wrap_blank.h and wrap_blank.cpp in each of those files they create a struct WrappedModule that contain the type, module, and a list of functions. They then use a function defined in
https://bitbucket.org/rude/love/src/eaf ... untime.cpp
To wrap the module. I hardly understand how they do things, but that's the basic idea. I only added one function to love and I used the infrastructure they had already set up. It seems simply enough.