Example #1
0
        static int __CreateInstance(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
                if (LuaAPI.lua_gettop(L) == 3 && translator.Assignable <System.Type>(L, 2) && (LuaAPI.lua_isnil(L, 3) || LuaAPI.lua_type(L, 3) == LuaTypes.LUA_TSTRING))
                {
                    System.Type _type       = (System.Type)translator.GetObject(L, 2, typeof(System.Type));
                    string      _methodName = LuaAPI.lua_tostring(L, 3);

                    DCETRuntime.MonoStaticMethod gen_ret = new DCETRuntime.MonoStaticMethod(_type, _methodName);
                    translator.Push(L, gen_ret);

                    return(1);
                }
            }
            catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
            return(LuaAPI.luaL_error(L, "invalid arguments to DCETRuntime.MonoStaticMethod constructor!"));
        }
Example #2
0
        static int _m_Run(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                DCETRuntime.MonoStaticMethod gen_to_be_invoked = (DCETRuntime.MonoStaticMethod)translator.FastGetCSObj(L, 1);


                int gen_param_count = LuaAPI.lua_gettop(L);

                if (gen_param_count == 1)
                {
                    gen_to_be_invoked.Run(  );



                    return(0);
                }
                if (gen_param_count == 2 && translator.Assignable <object>(L, 2))
                {
                    object _a = translator.GetObject(L, 2, typeof(object));

                    gen_to_be_invoked.Run(
                        _a);



                    return(0);
                }
                if (gen_param_count == 3 && translator.Assignable <object>(L, 2) && translator.Assignable <object>(L, 3))
                {
                    object _a = translator.GetObject(L, 2, typeof(object));
                    object _b = translator.GetObject(L, 3, typeof(object));

                    gen_to_be_invoked.Run(
                        _a,
                        _b);



                    return(0);
                }
                if (gen_param_count == 4 && translator.Assignable <object>(L, 2) && translator.Assignable <object>(L, 3) && translator.Assignable <object>(L, 4))
                {
                    object _a = translator.GetObject(L, 2, typeof(object));
                    object _b = translator.GetObject(L, 3, typeof(object));
                    object _c = translator.GetObject(L, 4, typeof(object));

                    gen_to_be_invoked.Run(
                        _a,
                        _b,
                        _c);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }

            return(LuaAPI.luaL_error(L, "invalid arguments to DCETRuntime.MonoStaticMethod.Run!"));
        }