コード例 #1
0
        private static int GetMethodAux(ILuaState lua, BindingFlags flags)
        {
            var t     = (Type)lua.ToUserData(1);
            var mname = lua.ToString(2);
            var n     = lua.RawLen(3);
            var types = new Type[n];

            for (int i = 0; i < n; ++i)
            {
                lua.RawGetI(3, i + 1);
                types[i] = (Type)lua.ToUserData(-1);
                lua.Pop(1);
            }
            var minfo = t.GetMethod(mname,
                                    flags,
                                    null,
                                    CallingConventions.Any,
                                    types,
                                    null
                                    );

            if (minfo == null)
            {
                return(0);
            }
            else
            {
                var ffiMethod = new FFIMethodInfo(minfo);
                lua.PushLightUserData(ffiMethod);
                return(1);
            }
        }
コード例 #2
0
        private static int GetMethodAux(ILuaState lua, BindingFlags flags)
        {
            var t     = (Type)lua.ToUserData(1);
            var mname = lua.ToString(2);
            var n     = lua.RawLen(3);
            var types = new Type[n];

            for (int i = 0; i < n; ++i)
            {
                lua.RawGetI(3, i + 1);
                types[i] = (Type)lua.ToUserData(-1);
                lua.Pop(1);
            }
#if NETFX_CORE && UNITY_METRO && !UNITY_EDITOR
            var minfo = Type_WP_8_1.Type.GetMethod(t, mname, types);
#else
            var minfo = t.GetMethod(mname,
                                    flags,
                                    null,
                                    CallingConventions.Any,
                                    types,
                                    null
                                    );
#endif
            if (minfo == null)
            {
                return(0);
            }
            else
            {
                var ffiMethod = new FFIMethodInfo(minfo);
                lua.PushLightUserData(ffiMethod);
                return(1);
            }
        }
コード例 #3
0
ファイル: LuaFFILib.cs プロジェクト: matthewyang/UniLua
 private static int GetMethodAux( ILuaState lua, BindingFlags flags )
 {
     var t = (Type)lua.ToUserData(1);
     var mname = lua.ToString(2);
     var n = lua.RawLen(3);
     var types = new Type[n];
     for( int i=0; i<n; ++i )
     {
         lua.RawGetI( 3, i+1 );
         types[i] = (Type)lua.ToUserData(-1);
         lua.Pop(1);
     }
     var minfo = t.GetMethod( mname,
         flags,
         null,
         CallingConventions.Any,
         types,
         null
         );
     if( minfo == null )
     {
         return 0;
     }
     else
     {
         var ffiMethod = new FFIMethodInfo(minfo);
         lua.PushLightUserData( ffiMethod );
         return 1;
     }
 }