Init.lua file in Android
Posted: Sun May 19, 2019 2:59 am
Hello o/
I had an issue with starting a love file under Android. It couldn't find the library that I wanted to require. After some testing I figured out that you can't load the Init.lua for a module. For example, that's my filetree:
main.lua
-- mylib
---- Init.lua
---- somestuff.lua
The main.lua contains something like this:
require("mylib")
normally it will find the Init.lua in the mylib folder and require this file instead. But if you put the stuff into a *.love file it doesn't do it anymore. So - I can't use the library in Android as well. Why is this the case? What can I do to archiv this behavior?
I already tried to change the package.path variable and the same with the love.filesystem.setRequirePath() function. I wrote something like that in the top of my main file:
love.filesystem.setRequirePath("?.lua;?/init.lua;./?.lua;./?/init.lua;")
package.path = love.filesystem.getRequirePath() .. package.path
This solved my problem for the windows love file, but not for android. Any suggestions? I really don't want to change every require call to require("mylib.Init"). Any suggestions?
Sorry for my bad english, I tried to explain my issue as good as I could. Thank you for your time!
I had an issue with starting a love file under Android. It couldn't find the library that I wanted to require. After some testing I figured out that you can't load the Init.lua for a module. For example, that's my filetree:
main.lua
-- mylib
---- Init.lua
---- somestuff.lua
The main.lua contains something like this:
require("mylib")
normally it will find the Init.lua in the mylib folder and require this file instead. But if you put the stuff into a *.love file it doesn't do it anymore. So - I can't use the library in Android as well. Why is this the case? What can I do to archiv this behavior?
I already tried to change the package.path variable and the same with the love.filesystem.setRequirePath() function. I wrote something like that in the top of my main file:
love.filesystem.setRequirePath("?.lua;?/init.lua;./?.lua;./?/init.lua;")
package.path = love.filesystem.getRequirePath() .. package.path
This solved my problem for the windows love file, but not for android. Any suggestions? I really don't want to change every require call to require("mylib.Init"). Any suggestions?
Sorry for my bad english, I tried to explain my issue as good as I could. Thank you for your time!