我如何从java中的某个目录执行lua脚本,该脚本可以在调用对象中获取和设置值?
例如:
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;
}
}
然后在SomeLuaScript.lua
if javaParent.getSomeInt() > 3 then
javaParent.setSomeInt(1)
end