Пример #1
0
        public static IP5Any ArrayReplace(Runtime runtime, IP5Array array,
                                          IP5Any offset, IP5Any count,
                                          params IP5Any[] values)
        {
            int start = offset.AsInteger(runtime);
            int length = count.AsInteger(runtime);
            int max = array.GetCount(runtime);

            if (start < 0)
                start = max + start;
            if (length < 0)
                length = max + length - start;

            return array.Replace(runtime, start, length, values);
        }
Пример #2
0
        public static IP5Any ArraySplice(Runtime runtime, IP5Array array,
                                         IP5Any offset, IP5Any count)
        {
            int start, length, max = array.GetCount(runtime);

            if (offset == null)
                start = 0;
            else
                start = offset.AsInteger(runtime);
            if (start < 0)
                start = max + start;

            if (count == null)
                length = max - start;
            else
                length = count.AsInteger(runtime);
            if (length < 0)
                length = max + length - start;

            return array.Splice(runtime, start, length);
        }