Example #1
0
        static int _m_Replace(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                XLua.ObjectPool gen_to_be_invoked = (XLua.ObjectPool)translator.FastGetCSObj(L, 1);



                {
                    int    _index = LuaAPI.xlua_tointeger(L, 2);
                    object _o     = translator.GetObject(L, 3, typeof(object));

                    object gen_ret = gen_to_be_invoked.Replace(_index, _o);
                    translator.PushAny(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Example #2
0
        public void Update(RealStatePtr L, int index, object obj)
        {
            int udata = LuaAPI.xlua_tocsobj_fast(L, index);

            if (udata != -1)
            {
                objects.Replace(udata, obj);
            }
            else
            {
                UpdateCSObject update;
                if (custom_update_funcs.TryGetValue(obj.GetType(), out update))
                {
                    update(L, index, obj);
                }
                else
                {
                    throw new Exception("can not update [" + obj + "]");
                }
            }
        }