2

I have a method in c that is:

static int          callLuaFunctionWithParams(const char *functionName, int numParams, ...);

So it contains a variable number of arguments, and I want to export it so that it could be used on the android app. On the JNIBindings I'm exporting it like:

JNIEXPORT void JNICALL Java_com_example_callLuaFunctionWithParams(JNIEnv* env, jobject obj, jstring functionName, jint numParams, ...);  

but how can I specify that syntax on java

public native void callLuaFunctionWithParams(String functionName, int numParams, ????);

Thanks!

nirvik
  • 386
  • 2
  • 5
  • 18
  • 1
    Java requires varargs all to be of the same base type. You could specify `Object...varargs`, but then any conversion required is up to you. – user207421 Jan 20 '15 at 17:25

1 Answers1

1

This should works:

public native void callLuaFunctionWithParams(String functionName, int numParams, Object... params);
bonnyz
  • 13,458
  • 5
  • 46
  • 70