I assume you are using the API wrong. This following cctest code worked
perfectly fine for me:
THREADED_TEST(ArraySetLength0) {
v8::HandleScope scope;
LocalContext context;
v8::Handle<v8::Value> value = CompileRun("[1, 2, 3]");
CHECK(value->IsArray());
v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(value);
array->Set(v8_str("length"), v8::Number::New(0));
CHECK_EQ(0, array->Length());
}
Yang
On Friday, December 7, 2012 3:24:12 PM UTC+1, Paul Harris wrote:
>
> Hi,
>
> How do I do the equivalent of:
> var x = [1,2,3];
> x.length = 1; // THIS BIT
>
> I tried doing
> Array * target = etc;
> target->Set( String::NewSymbol("length"), 1 );
> but that didn't work as expected, or crashed in the case of zero.
>
> ideas?
> Thanks,
> Paul
>
>
--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users