Damn you, Oleg, stealing my thunder. I'd just typed my reply when yours came in!
You can check with args[0]->IsArray() if the argument is really an
array, then cast it with:
Local<Array> a = Array::Cast(*arg[0]);
printf("Array length: %d\n", a.Length());
You need to apply the IsArray() check + cast inside the loop.
if (args[0]->IsArray()) {
Local<Array> a = Array::Cast(*args[0]);
for (int index = 0, size = a->Length(); index < size; index++) {
Local<Value> element = a->Get(index);
if (element->IsArray()) {
Local<Array> b = Array::Cast(*element);
// do useful stuff with b
}
}
}