IronLua.Runtime.LuaTable.Length C# (CSharp) Method

Length() private method

private Length ( ) : int
return int
        internal int Length()
        {
            var lastNum = 0;
            foreach (var key in entries.Select(e => e.Key).OfType<double>().OrderBy(key => key))
            {
                var intKey = (int)key;

                if (intKey > lastNum + 1)
                    return lastNum;
                if (intKey != key)
                    continue;
                
                lastNum = intKey;
            }
            return lastNum;
        }

Usage Example

示例#1
0
        public static Varargs IPairs(LuaTable t)
        {
            var length = t.Length();
            Func<double, object> func =
                index =>
                    {
                        index++;
                        return index > length ? null : new Varargs(index, t.GetValue(index));
                    };

            return new Varargs(func, t, 0.0);
        }
All Usage Examples Of IronLua.Runtime.LuaTable::Length