So I decided to have a little look at lua scripting for fun, decided on LuaJ after some googling.
I am just using an existing code base for this, as you might have read in this thread here, I was looking for a way to handle component data outside of the java code. Like loading from JSON (this is my method at the moment) or XML.
So yeah, here is the problem.
This an Android game, that is where the problem lies as it works fine on desktop. It can find, load and run the script just fine.
Here is the script:
function init(entity)
local package = "com.gibbo.components";
local size = luajava.newInstance(package..".SizeComponent");
size:setWidth(1.5f);
size:setHeight(1.5f);
entity:add(size);
end
The obvious problematic line is [icode]local size = luajava.newInstance(packageā¦".SizeComponent");[/icode], which can not be found on Android. I am not sure what else I can say, besides that I have the error:
03-31 14:51:16.038: I/ERROR(26785): Lua error
03-31 14:51:16.038: I/ERROR(26785): function init(entity, position)
03-31 14:51:16.038: I/ERROR(26785): local package = "com.gibbo.components";
03-31 14:51:16.038: I/ERROR(26785): local size = luajava.newInstance(package..".SizeComponent");
03-31 14:51:16.038: I/ERROR(26785): size:setWidth(1.5f);
03-31 14:51:16.038: I/ERROR(26785): size:setHeight(1.5f);
03-31 14:51:16.038: I/ERROR(26785): entity:add(size);
03-31 14:51:16.038: I/ERROR(26785): end
03-31 14:51:16.038: I/ERROR(26785):
03-31 14:51:16.038: I/ERROR(26785): :4 vm error: java.lang.ClassNotFoundException: com.gibbo.components.SizeComponent
There is obviously some sort of difference about how android is compiled compared to desktop, but yeah, not sure what to do from here.
UPDATE:
I found this on stack overflow that states I can either downgrade to fix the problem, however I can not find any documentation for anything prior to LuaJ 3.0. So I decided to instead go with the second second suggestions, I downloaded the source and found the missing libaries and changed the source. But nada, still same problem.