Page 1 of 1

Decent tutorial for making c++ dll compatible w/ lua/love2d?

Posted: Tue Jun 02, 2015 5:30 am
by RonanZero
I already have my C++ function ready to go and I looked up how to actually make it work in Lua and it is extremely complicated, I can't figure out what I have to do to just run a function in C++ that returns an int to Lua. I already did the include things that I have to do to get it to work with Lua. But I just get so many errors. So is there a decent, thorough tutorial for making a c++ dll compatible with lua?

Re: Decent tutorial for making c++ dll compatible w/ lua/lov

Posted: Tue Jun 02, 2015 2:54 pm
by I~=Spam
I don't have a "tutorial" for you but I did make a simple library that is compatible with LOVE on Linux and Windows (I have no idea if it will work on OSX) with cmake. :)

Here it is: https://github.com/GoogleBot42/IronBox

The important files and folders is the "CMakeLists.txt" for cmake and the c_src directory. The lib directory in the c src is for storing the 32bit and 64bit lib files needed to compile on windows. On Linux lua just needs to be be installed and gcc or clang will be able to find it. ;)

BTW are you by chance taking my suggestion to write the anti-pirating code in c/c++ as I suggested in another thread? Unfortunately, if this is what you are doing I do not think it is not a good idea. A pirater could easily remove the "require" needed to load the lib and can the code to remove the pirating checks. It might be slightly better to build LOVE itself with the checks built-in and run the check before the lua code is even run but then the pirater could copy the lua code out of the executable with a zip program and run that with a normal version of LOVE.