Ambiguity in string.slice()

I just noticed what I believe is an ambiguity in the documentation for string.slice()

It states:

Squirrel continues copying characters one after the other from this point onward until it reaches either the end of the source string or the index specified as the method’s optional second parameter.

If I set the optional index to be beyond the end of the string, I’d expect it to return only up to the actual end of the string. Instead, it raises an exception.

testStr <- "01234"
server.log(testStr.slice(0,3))  // works
server.log(testStr.slice(0,6))  // fails

I’m not saying that the behaviour of string.slice is wrong, I think the docs need to be more explicit. :slight_smile:

Fixed. And I took the opportunity to update the array.slice() doc, which had the same ambiguity.