31.03.2016, 15:06
@dusk: I added array support in this commit: https://github.com/Shoebill/Shoebill...d6735451e09bbc
Currently it is only working with Integers and Floats, Strings are somehow not working correctly but I don't know why at the moment. You can update your plugin via the shoebill-updater.
This is how to use it:
After your array declaration in the header, you will always have to add a parameter for the length, because it can't be received via sizeof. You can not use primitive types such as int or float, you have to use Float and Integer as Objects. You can cast a primitive int to an Integer by using:
If you want to call a public function via callPublic and you only use one array as an argument, it is important that you cast your array to an Object, because otherwise the compiler will be confused if you want to call the method as varargs or non-varargs. If you pass two or more parameters, this should not be a problem. Here is a full example:
Currently it is only working with Integers and Floats, Strings are somehow not working correctly but I don't know why at the moment. You can update your plugin via the shoebill-updater.
This is how to use it:
pawn Код:
forward testJavaPawn(Float:values[], valLen, second[], secondLen);
public testJavaPawn(Float:values[], valLen, second[], secondLen)
{
for(new i = 0; i < valLen; i++)
{
printf("Value in Values slot #%i: %f", i, values[i]);
}
for(new i = 0; i < secondLen; i++)
{
printf("Value in Second slot #%i: %i", i, second[i]);
}
return 1;
}
PHP код:
Integer integer = (Integer) myPrimitiveInt;
PHP код:
AmxCallable callback = null;
for(AmxInstance instance : AmxInstanceManager.get().getAmxInstances()) {
if((callback = instance.getPublic("testJavaPawn")) != null)
break;
}
assert callback != null;
Float[] values = new Float[] {5.3f, 12.4f, 5.75f, 7.1f, 88.897f};
callback.call((Object) values); //Cast to Object because of varargs confusion.
//callback.call(values, myNumber); <--- No need to cast because there are 2 parameters.