コード例 #1
0
 public void RegisterCaster <T>(GetFunc <T> get)
 {
     objectCasters.AddCaster(typeof(T), (L, idx, o) =>
     {
         T obj;
         get(L, idx, out obj);
         return(obj);
     });
 }
コード例 #2
0
        static int _m_AddCaster(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


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



                {
                    System.Type     _type = (System.Type)translator.GetObject(L, 2, typeof(System.Type));
                    XLua.ObjectCast _oc   = translator.GetDelegate <XLua.ObjectCast>(L, 3);

                    gen_to_be_invoked.AddCaster(_type, _oc);



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