Exemplo n.º 1
0
        private static int FFI_GetConstructor(ILuaState lua)
        {
            var t     = (Type)lua.ToUserData(1);
            var n     = lua.RawLen(2);
            var types = new Type[n];

            for (int i = 0; i < n; ++i)
            {
                lua.RawGetI(2, i + 1);
                types[i] = (Type)lua.ToUserData(-1);
                lua.Pop(1);
            }

            var cinfo     = t.GetConstructor(types);
            var ffiMethod = new FFIConstructorInfo(cinfo);

            lua.PushLightUserData(ffiMethod);
            return(1);
        }
Exemplo n.º 2
0
        private static int FFI_GetConstructor(ILuaState lua)
        {
            var t     = (Type)lua.ToUserData(1);
            var n     = lua.RawLen(2);
            var types = new Type[n];

            for (int i = 0; i < n; ++i)
            {
                lua.RawGetI(2, i + 1);
                types[i] = (Type)lua.ToUserData(-1);
                lua.Pop(1);
            }

#if NETFX_CORE && UNITY_METRO && !UNITY_EDITOR
            var cinfo = WinRTLegacy.TypeExtensions.GetConstructor(t, types);
#else
            var cinfo = t.GetConstructor(types);
#endif
            var ffiMethod = new FFIConstructorInfo(cinfo);
            lua.PushLightUserData(ffiMethod);
            return(1);
        }
Exemplo n.º 3
0
        private static int FFI_GetConstructor( ILuaState lua )
        {
            var t = (Type)lua.ToUserData(1);
            var n = lua.RawLen(2);
            var types = new Type[n];
            for( int i=0; i<n; ++i )
            {
                lua.RawGetI( 2, i+1 );
                types[i] = (Type)lua.ToUserData(-1);
                lua.Pop( 1 );
            }

            var cinfo = t.GetConstructor( types );
            var ffiMethod = new FFIConstructorInfo(cinfo);
            lua.PushLightUserData( ffiMethod );
            return 1;
        }