Пример #1
0
        static int _m_AddComponent(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                DCET.Model.Entity gen_to_be_invoked = (DCET.Model.Entity)translator.FastGetCSObj(L, 1);


                int gen_param_count = LuaAPI.lua_gettop(L);

                if (gen_param_count == 2 && translator.Assignable <DCET.Model.Entity>(L, 2))
                {
                    DCET.Model.Entity _component = (DCET.Model.Entity)translator.GetObject(L, 2, typeof(DCET.Model.Entity));

                    DCET.Model.Entity gen_ret = gen_to_be_invoked.AddComponent(_component);
                    translator.Push(L, gen_ret);



                    return(1);
                }
                if (gen_param_count == 2 && translator.Assignable <System.Type>(L, 2))
                {
                    System.Type _type = (System.Type)translator.GetObject(L, 2, typeof(System.Type));

                    DCET.Model.Entity gen_ret = gen_to_be_invoked.AddComponent(_type);
                    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 DCET.Model.Entity.AddComponent!"));
        }