Oops, implement the previously-mentioned fix without breaking support

for omitting a length argument to mean "the rest of the vector".
This commit is contained in:
andy 2006-03-21 23:12:30 +00:00
parent 9d6c0dc580
commit 6b056e915e

View File

@ -69,7 +69,8 @@ static naRef subvec(naContext c, naRef me, int argc, naRef* args)
len = (int)nlen.num; len = (int)nlen.num;
if(!naIsVector(v) || start < 0 || start >= naVec_size(v) || len < 0) if(!naIsVector(v) || start < 0 || start >= naVec_size(v) || len < 0)
return naNil(); return naNil();
if(len > naVec_size(v) - start) len = naVec_size(v) - start; if(naIsNil(nlen) || len > naVec_size(v) - start)
len = naVec_size(v) - start;
result = naNewVector(c); result = naNewVector(c);
naVec_setsize(result, len); naVec_setsize(result, len);
for(i=0; i<len; i++) for(i=0; i<len; i++)