Example #1
0
        public void Get(RealStatePtr L, int index, out IFramework.Hotfix.Lua.MyStruct val)
        {
            LuaTypes type = LuaAPI.lua_type(L, index);

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

                IntPtr buff = LuaAPI.lua_touserdata(L, index); if (!CopyByValue.UnPack(buff, 0, out val))
                {
                    throw new Exception("unpack fail for IFramework.Hotfix.Lua.MyStruct");
                }
            }
            else if (type == LuaTypes.LUA_TTABLE)
            {
                CopyByValue.UnPack(this, L, index, out val);
            }
            else
            {
                val = (IFramework.Hotfix.Lua.MyStruct)objectCasters.GetCaster(typeof(IFramework.Hotfix.Lua.MyStruct))(L, index, null);
            }
        }
Example #2
0
        public static bool UnPack(IntPtr buff, int offset, out IFramework.Hotfix.Lua.MyStruct field)
        {
            field = default(IFramework.Hotfix.Lua.MyStruct);

            if (!UnPack(buff, offset, out field.a))
            {
                return(false);
            }

            if (!UnPack(buff, offset + 4, out field.b))
            {
                return(false);
            }

            if (!UnPack(buff, offset + 8, out field.c))
            {
                return(false);
            }

            if (!UnPack(buff, offset + 24, out field.e))
            {
                return(false);
            }

            return(true);
        }
Example #3
0
        public static void UnPack(ObjectTranslator translator, RealStatePtr L, int idx, out IFramework.Hotfix.Lua.MyStruct val)
        {
            val = new IFramework.Hotfix.Lua.MyStruct();
            int top = LuaAPI.lua_gettop(L);

            if (Utils.LoadField(L, idx, "a"))
            {
                translator.Get(L, top + 1, out val.a);
            }
            LuaAPI.lua_pop(L, 1);

            if (Utils.LoadField(L, idx, "b"))
            {
                translator.Get(L, top + 1, out val.b);
            }
            LuaAPI.lua_pop(L, 1);

            if (Utils.LoadField(L, idx, "c"))
            {
                translator.Get(L, top + 1, out val.c);
            }
            LuaAPI.lua_pop(L, 1);

            if (Utils.LoadField(L, idx, "e"))
            {
                translator.Get(L, top + 1, out val.e);
            }
            LuaAPI.lua_pop(L, 1);
        }
Example #4
0
        static int __CreateInstance(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
                if (LuaAPI.lua_gettop(L) == 3 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3))
                {
                    int _p1 = LuaAPI.xlua_tointeger(L, 2);
                    int _p2 = LuaAPI.xlua_tointeger(L, 3);

                    IFramework.Hotfix.Lua.MyStruct gen_ret = new IFramework.Hotfix.Lua.MyStruct(_p1, _p2);
                    translator.PushIFrameworkHotfixLuaMyStruct(L, gen_ret);

                    return(1);
                }

                if (LuaAPI.lua_gettop(L) == 1)
                {
                    translator.PushIFrameworkHotfixLuaMyStruct(L, default(IFramework.Hotfix.Lua.MyStruct));
                    return(1);
                }
            }
            catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
            return(LuaAPI.luaL_error(L, "invalid arguments to IFramework.Hotfix.Lua.MyStruct constructor!"));
        }
Example #5
0
        public void PushIFrameworkHotfixLuaMyStruct(RealStatePtr L, IFramework.Hotfix.Lua.MyStruct val)
        {
            if (IFrameworkHotfixLuaMyStruct_TypeID == -1)
            {
                bool is_first;
                IFrameworkHotfixLuaMyStruct_TypeID = getTypeId(L, typeof(IFramework.Hotfix.Lua.MyStruct), out is_first);
            }

            IntPtr buff = LuaAPI.xlua_pushstruct(L, 25, IFrameworkHotfixLuaMyStruct_TypeID);

            if (!CopyByValue.Pack(buff, 0, val))
            {
                throw new Exception("pack fail fail for IFramework.Hotfix.Lua.MyStruct ,value=" + val);
            }
        }
Example #6
0
		public IFramework.Hotfix.Lua.MyStruct __Gen_Delegate_Imp3(IFramework.Hotfix.Lua.MyStruct 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.PushIFrameworkHotfixLuaMyStruct(L, p0);
                
                PCall(L, 1, 1, errFunc);
                
                
                IFramework.Hotfix.Lua.MyStruct __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 #7
0
        public void UpdateIFrameworkHotfixLuaMyStruct(RealStatePtr L, int index, IFramework.Hotfix.Lua.MyStruct val)
        {
            if (LuaAPI.lua_type(L, index) == LuaTypes.LUA_TUSERDATA)
            {
                if (LuaAPI.xlua_gettypeid(L, index) != IFrameworkHotfixLuaMyStruct_TypeID)
                {
                    throw new Exception("invalid userdata for IFramework.Hotfix.Lua.MyStruct");
                }

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

            else
            {
                throw new Exception("try to update a data with lua type:" + LuaAPI.lua_type(L, index));
            }
        }
Example #8
0
        public static bool Pack(IntPtr buff, int offset, IFramework.Hotfix.Lua.MyStruct field)
        {
            if (!Pack(buff, offset, field.a))
            {
                return(false);
            }

            if (!Pack(buff, offset + 4, field.b))
            {
                return(false);
            }

            if (!Pack(buff, offset + 8, field.c))
            {
                return(false);
            }

            if (!Pack(buff, offset + 24, field.e))
            {
                return(false);
            }

            return(true);
        }
        static int _m_StructParamMethod(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


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



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

                    IFramework.Hotfix.Lua.MyStruct gen_ret = gen_to_be_invoked.StructParamMethod(_p);
                    translator.PushIFrameworkHotfixLuaMyStruct(L, gen_ret);



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