public virtual P5List Slice(Runtime runtime, P5Array keys) { var res = new P5List(runtime); var list = new List<IP5Any>(keys.GetCount(runtime)); bool found = false; foreach (var key in keys) { int i = key.AsInteger(runtime); if (i < array.Count) found = true; list.Add(GetItemOrUndef(runtime, key, false)); } if (found) res.SetArray(list); return res; }
public P5List Slice(Runtime runtime, P5Array keys, bool create) { var res = new P5List(runtime, (List<IP5Any>) null); var list = new List<IP5Any>(); foreach (var key in keys) { list.Add(GetItemOrUndef(runtime, key, create)); } res.SetArray(list); return res; }