Lua C++ connection

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Julinator
Prole
Posts: 2
Joined: Sat Aug 06, 2016 10:39 am
Location: The Netherlands

Lua C++ connection

Post 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.
bobbyjones
Party member
Posts: 730
Joined: Sat Apr 26, 2014 7:46 pm

Re: Lua C++ connection

Post 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
Julinator
Prole
Posts: 2
Joined: Sat Aug 06, 2016 10:39 am
Location: The Netherlands

Re: Lua C++ connection

Post 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?
bobbyjones
Party member
Posts: 730
Joined: Sat Apr 26, 2014 7:46 pm

Re: Lua C++ connection

Post 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.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 5 guests