I'm having trouble calling Lua scripts from Java via LuaJ on Android that require other Lua scripts. I think it's something to do with my current working directory.
What I'm trying in Java:
InputStream input = EvilApp.getContext().getAssets().open("lua/pathTest.lua");
Prototype p = LuaC.instance.compile(input, "pathTest.lua");
LuaValue g = JsePlatform.standardGlobals();
LuaClosure c = new LuaClosure(p, g);
c.call();
pathTest.lua:
require "Foo"
local str = Foo.getString()
print(str)
For this specific test, both lua files are in the same directory for simplicity, but I will need relative paths to other lua files.
I've tried playing with package.path, but nothing I've tried has worked. When running in Android, package.path == "?.lua" by default.
I've run this test with relative paths via commandline, and inside Eclipse using Koneki, and they work fine. It's specifically the Android environment that's failing.
Also, I'm able to get Lua scripts with no requires to work fine in Android.