Using Java Interfaces in Lua Script with LuaJ

62 Views Asked by At

I have a method like below in Java for starting animation sequences

public void addAnimationSequence(final Vector3[] targetOffset, int duration, final AnimationFinishedListener animationFinishedListener){

}

AnimationFinishedListener is below:

public interface AnimationFinishedListener {
    void onAnimationFinished(BaseAnimation pAnimation);
}

and i'm using that method from my lua script but i'm getting

coercion error java.lang.IllegalArgumentException: argument type mismatch

error in Java.I'm using LuaJ by the way. Is there a way to use Java interfaces in Lua?

cube:addAnimationSequences(
            {
                Vector3.new(0, -4, 0),
                Vector3.new(portalExitPosition.x + portalExitDirection.x, portalExitPosition.y + portalExitDirection.y, portalExitPosition.z + portalExitDirection.z)
            },
            800,
            onAnimationFinished = function(pAnimation)
                cube:rotateLeft()
            end
        )
0

There are 0 best solutions below