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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user