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!
Init.lua file in Android
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- slime
- Solid Snayke
- Posts: 3166
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: Init.lua file in Android
init.lua shouldn't be capitalized. The windows filesystem isn't case sensitive so the problem can't be detected when your game is a plain folder there, but once it's been zipped into a .love (or if it's a plain folder on case-sensitive filesystems such as in Linux), then it matters.
Re: Init.lua file in Android
I can't believe that... After around 9 years experience with different programming languages... And then I do such a banal mistake...
Yes, I forget about that and was trying around 6 hours now to figure out how to load the modules...
Thank you - and shame on me *facepalm*
Yes, I forget about that and was trying around 6 hours now to figure out how to load the modules...
Thank you - and shame on me *facepalm*
Re: Init.lua file in Android
It's not about programming languages. It's about NTFS not being case-sensitive by default (also being the default filesystem on Microsoft OSes).
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 4 guests