Exemple #1
0
        public void PushMinecraftBlocksDataBlockVertexType(RealStatePtr L, Minecraft.BlocksData.BlockVertexType val)
        {
            if (MinecraftBlocksDataBlockVertexType_TypeID == -1)
            {
                bool is_first;
                MinecraftBlocksDataBlockVertexType_TypeID = getTypeId(L, typeof(Minecraft.BlocksData.BlockVertexType), out is_first);

                if (MinecraftBlocksDataBlockVertexType_EnumRef == -1)
                {
                    Utils.LoadCSTable(L, typeof(Minecraft.BlocksData.BlockVertexType));
                    MinecraftBlocksDataBlockVertexType_EnumRef = LuaAPI.luaL_ref(L, LuaIndexes.LUA_REGISTRYINDEX);
                }
            }

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

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

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

            LuaAPI.lua_getref(L, MinecraftBlocksDataBlockVertexType_EnumRef);
            LuaAPI.lua_pushvalue(L, -2);
            LuaAPI.xlua_rawseti(L, -2, (int)val);
            LuaAPI.lua_pop(L, 1);
        }
Exemple #2
0
        public void Get(RealStatePtr L, int index, out Minecraft.BlocksData.BlockVertexType val)
        {
            LuaTypes type = LuaAPI.lua_type(L, index);

            if (type == LuaTypes.LUA_TUSERDATA)
            {
                if (LuaAPI.xlua_gettypeid(L, index) != MinecraftBlocksDataBlockVertexType_TypeID)
                {
                    throw new Exception("invalid userdata for Minecraft.BlocksData.BlockVertexType");
                }

                IntPtr buff = LuaAPI.lua_touserdata(L, index);
                int    e;
                if (!CopyByValue.UnPack(buff, 0, out e))
                {
                    throw new Exception("unpack fail for Minecraft.BlocksData.BlockVertexType");
                }
                val = (Minecraft.BlocksData.BlockVertexType)e;
            }
            else
            {
                val = (Minecraft.BlocksData.BlockVertexType)objectCasters.GetCaster(typeof(Minecraft.BlocksData.BlockVertexType))(L, index, null);
            }
        }
Exemple #3
0
        public void UpdateMinecraftBlocksDataBlockVertexType(RealStatePtr L, int index, Minecraft.BlocksData.BlockVertexType val)
        {
            if (LuaAPI.lua_type(L, index) == LuaTypes.LUA_TUSERDATA)
            {
                if (LuaAPI.xlua_gettypeid(L, index) != MinecraftBlocksDataBlockVertexType_TypeID)
                {
                    throw new Exception("invalid userdata for Minecraft.BlocksData.BlockVertexType");
                }

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

            else
            {
                throw new Exception("try to update a data with lua type:" + LuaAPI.lua_type(L, index));
            }
        }