public object[] next(Table table, params object[] p) { object index = p.Length > 0 ? p[0] : Nil.Value; index = table.NextKey(index); object o = table[index]; if (o == Nil.Value) { return new object[] { Nil.Value }; } else if (o == null) throw new Exception("Key does not exist in the table"); else { return new object[] { index, o }; } }