public Array splice(ARGS arg) { if (!arg.check(typeof(int), typeof(int), typeof(string))) { return(null); } int start = (int)arg.Get(0); int count = (int)arg.Get(1); string wd = (string)arg.Get(2); var keyList = new List <object>(); foreach (var k in m_hash.Keys) { keyList.Add(k); } var valList = new List <object>(); foreach (var k in m_hash.Keys) { keyList.Add(m_hash[k]); } var newarray = new Array(); for (int i = 0; i < keyList.Count; i++) { object o = valList[i]; if (i >= start && i < start + count) { o = wd; } newarray.Set(keyList[i], o); } return(newarray); }
public Array slice(ARGS arg) { if (!arg.check(typeof(int), typeof(int))) { return(null); } var start = (int)arg.Get(0); var end = (int)arg.Get(1); var keyList = new List <object>(); foreach (var k in m_hash.Keys) { keyList.Add(k); } var valList = new List <object>(); foreach (var k in m_hash.Keys) { keyList.Add(m_hash[k]); } var newarray = new Array(); for (int i = start; i < end; i++) { newarray.Set(keyList[i], valList[i]); } return(newarray); }