Length() 개인적인 메소드

private Length ( ) : int
리턴 int
예제 #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);
        }
예제 #2
0
        public Varargs Unpack(LuaTable list, object i = null, object j = null)
        {
            var listLength = list.Length();

            var startIndex = ConvertToNumber(i, 2, 1.0);
            var length = ConvertToNumber(j, 3, listLength);

            if (startIndex < 1)
                return Varargs.Empty;
            length = Math.Min(length, listLength - startIndex + 1);

            var array = new object[(int)length];
            var arrayIndex = 0;
            for (var k = startIndex; k < startIndex + length; k++)
                array[arrayIndex++] = list.GetValue(k);

            return new Varargs(array);
        }