love2d / love-android

Android build setup for LÖVE.
https://love2d.org
Other
200 stars 70 forks source link

package.cpath load module location #228

Closed amsitlab closed 2 years ago

amsitlab commented 2 years ago

Hy.. I hope somebody guide me about love package.cpath on android device.

  1. I have writing some code (main.lua), like :
    
    local love = require 'love'
    local graphics = love.graphics

function love.draw() local package = package graphics.print(package.cpath, 200,200) end



2. packing it as zip:
`zip -9 game.love main.lua`

3. load using file manager, open as * / *, then pick Love app.
4. 
![Screenshot_20220409-200430](https://user-images.githubusercontent.com/10000281/162575551-fef7d1cd-c010-437e-8711-74495722c524.png)

is Love loading Lua (C library) from path `/usr/local/lib/lua/5.1/*.so` on android device? or thats a bug?

Yess, I know, we can override `package.cpath` .
NOTE: Love App I have download from Go*glePlayStrore.
MikuAuahDark commented 2 years ago

It's because Lua(JIT) requires that the default package.cpath determined at compile time, which is not possible in Android, thus you'll see that useless /usr/local paths. Furthermore, you can't set the cpath to your save directory due to Android 10 restriction.

LOVE 11.4 (love2d/love@b79b99bbaa60fb283d160782e5b31f953b43760c) implements special case for Android that allows loading Lua C modules if you put them inside your APK libs folder (within their respective ABI folder of course) that solves Android 10 issue. Unfortunately Play Store version is still 11.3.