1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-24 04:07:41 +00:00

Add classes to core library.

This commit is contained in:
Calvin Rose
2018-11-25 15:58:50 -05:00
parent d4ee760b3e
commit b2a1a4ec9b
8 changed files with 227 additions and 27 deletions

View File

@@ -257,6 +257,8 @@ static int cfun_slice(JanetArgs args) {
}
if (start < 0) start = len + start;
if (end < 0) end = len + end + 1;
if (end < 0 || start < 0 || end > len || start > len)
JANET_THROW(args, "slice range out of bounds");
if (end >= start) {
ret = janet_buffer(end - start);
memcpy(ret->data, data + start, end - start);