I'm adding a new C++ module to love, I've downloaded the sources and compiled the project, once I got that working I added my own module to love, but when building it, it doesn't seem to have my love.myModule
Things I've done so far:
- I copied how other modules are registered, so my module has an extern "C" int luaopen_love_myModule(lua_State *L)
- Inside that function I end up calling return luax_register_module(L, w);
- I have defined: #define instance() (Module::getInstance<MyModule>(Module::M_MYMODULE))
- I'm adding my module in static const luaL_Reg modules[]
- When int luaopen_love(lua_State *L) gets called, I can see myModule is being preloaded in the for loop for (int i = 0; modules.name != nullptr; i++)
- To make sure I'm actually making changes to the source correctly, I changed the codename value to "Test" and when launching love.exe after building, it prints the value "Test" rather than "Super Toast"
I'm pretty sure I'm missing something as love.myModule is not inside love._modules when debugging my game with the love.exe I'm building.
Can someone point me in the right direction?
Thanks!
Last edited by Mariscal on Sat Jan 14, 2017 4:30 pm, edited 1 time in total.
Currently working on Breaking Fast, a competitive 2D "mario kart alike" racing game! Already passed steam greenlight, hopefully soon to be released!
Please don't double, triple or quadruple post. Also, I'm fairly sure you didn't need to edit boot.lua, you could just have required your module manually.
@raidho36: Steamworks integration
@bartbes: Sorry, should have probably edited my first reply! I'm also not very experienced with Lua, so just went for the C++ approach, and yes, I know I can also use luaJIT/FFI to achieve what I wanted, I've tried it and and by doing the same that steam provides in their C++ example some calls to their API crash, and without any documentation I was hitting a dead end.
Currently working on Breaking Fast, a competitive 2D "mario kart alike" racing game! Already passed steam greenlight, hopefully soon to be released!
I don't think LuaJIT can pick up C++ binaries. To much wonky stuff is going on inside them, you pretty much need to compile both using identical tool chain for two C++ programs to couple.