Reputation: 47
How would I go about executing a lua script from some directory from java that can get and set values in the calling object?
For example:
public SomeJavaClass
{
public int someInt;
public SomeJavaClass(int i)
{
this.someInt = i;
}
public void runLuaScript(String script)
{
executeSomeLuaScriptSomehow(script);
}
public int getSomeInt()
{
return someInt;
}
public void setSomeInt(int i)
{
this.someInt = i;
}
}
And then in SomeLuaScript.lua
if javaParent.getSomeInt() > 3 then
javaParent.setSomeInt(1)
end
Upvotes: 2
Views: 2225