How to convert v8 Value to Array

Viewed 11351

I'm writing a c++ extension to v8, and want to pass an Array object into it. I see the incoming argument can be tested by IsArray(), but there isn't a ToArray().

How do you get access to its Length, and request elements by numeric index?

Handle<Value> MyExtension(const Arguments& args)
{
    Handle<Value> v = args[0];
    if(v->IsArray())
    {
        // convert to array, find its length, and access its members by index... ?
    }
...
}

Must be missing something obvious here. Object can return all its properties, but that's not quite what I was hoping for. Is there a way to get it as an Arrray?

Thanks for reading.

4 Answers
Related