Example #1
0
        public void PushIFrameworkLuaMyEnum(RealStatePtr L, IFramework.Lua.MyEnum val)
        {
            if (IFrameworkLuaMyEnum_TypeID == -1)
            {
                bool is_first;
                IFrameworkLuaMyEnum_TypeID = getTypeId(L, typeof(IFramework.Lua.MyEnum), out is_first);

                if (IFrameworkLuaMyEnum_EnumRef == -1)
                {
                    Utils.LoadCSTable(L, typeof(IFramework.Lua.MyEnum));
                    IFrameworkLuaMyEnum_EnumRef = LuaAPI.luaL_ref(L, LuaIndexes.LUA_REGISTRYINDEX);
                }
            }

            if (LuaAPI.xlua_tryget_cachedud(L, (int)val, IFrameworkLuaMyEnum_EnumRef) == 1)
            {
                return;
            }

            IntPtr buff = LuaAPI.xlua_pushstruct(L, 4, IFrameworkLuaMyEnum_TypeID);

            if (!CopyByValue.Pack(buff, 0, (int)val))
            {
                throw new Exception("pack fail fail for IFramework.Lua.MyEnum ,value=" + val);
            }

            LuaAPI.lua_getref(L, IFrameworkLuaMyEnum_EnumRef);
            LuaAPI.lua_pushvalue(L, -2);
            LuaAPI.xlua_rawseti(L, -2, (int)val);
            LuaAPI.lua_pop(L, 1);
        }
Example #2
0
        public void UpdateIFrameworkLuaMyEnum(RealStatePtr L, int index, IFramework.Lua.MyEnum val)
        {
            if (LuaAPI.lua_type(L, index) == LuaTypes.LUA_TUSERDATA)
            {
                if (LuaAPI.xlua_gettypeid(L, index) != IFrameworkLuaMyEnum_TypeID)
                {
                    throw new Exception("invalid userdata for IFramework.Lua.MyEnum");
                }

                IntPtr buff = LuaAPI.lua_touserdata(L, index);
                if (!CopyByValue.Pack(buff, 0, (int)val))
                {
                    throw new Exception("pack fail for IFramework.Lua.MyEnum ,value=" + val);
                }
            }

            else
            {
                throw new Exception("try to update a data with lua type:" + LuaAPI.lua_type(L, index));
            }
        }
Example #3
0
        public IFramework.Lua.MyEnum __Gen_Delegate_Imp4(IFramework.Lua.MyEnum p0)
        {
#if THREAD_SAFE || HOTFIX_ENABLE
            lock (luaEnv.luaEnvLock)
            {
#endif
            RealStatePtr L = luaEnv.rawL;
            int errFunc    = LuaAPI.pcall_prepare(L, errorFuncRef, luaReference);
            ObjectTranslator translator = luaEnv.translator;
            translator.PushIFrameworkLuaMyEnum(L, p0);

            PCall(L, 1, 1, errFunc);


            IFramework.Lua.MyEnum __gen_ret; translator.Get(L, errFunc + 1, out __gen_ret);
            LuaAPI.lua_settop(L, errFunc - 1);
            return(__gen_ret);

#if THREAD_SAFE || HOTFIX_ENABLE
        }
#endif
        }
Example #4
0
        public void Get(RealStatePtr L, int index, out IFramework.Lua.MyEnum val)
        {
            LuaTypes type = LuaAPI.lua_type(L, index);

            if (type == LuaTypes.LUA_TUSERDATA)
            {
                if (LuaAPI.xlua_gettypeid(L, index) != IFrameworkLuaMyEnum_TypeID)
                {
                    throw new Exception("invalid userdata for IFramework.Lua.MyEnum");
                }

                IntPtr buff = LuaAPI.lua_touserdata(L, index);
                int    e;
                if (!CopyByValue.UnPack(buff, 0, out e))
                {
                    throw new Exception("unpack fail for IFramework.Lua.MyEnum");
                }
                val = (IFramework.Lua.MyEnum)e;
            }
            else
            {
                val = (IFramework.Lua.MyEnum)objectCasters.GetCaster(typeof(IFramework.Lua.MyEnum))(L, index, null);
            }
        }
        static int _m_EnumParamMethod(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                IFramework.Lua.NoGc gen_to_be_invoked = (IFramework.Lua.NoGc)translator.FastGetCSObj(L, 1);



                {
                    IFramework.Lua.MyEnum _p; translator.Get(L, 2, out _p);

                    IFramework.Lua.MyEnum gen_ret = gen_to_be_invoked.EnumParamMethod(_p);
                    translator.PushIFrameworkLuaMyEnum(L, gen_ret);



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