weixin_43965271
2019-07-17 09:25
采纳率: 33.3%
浏览 537

LUA 如何监控变量变化

function GetItemCount(recoveryClientBaseTab,counttab)
    local tab = {}
    local equipmentTab1 = recoveryClientBaseTab["装备表"]
    local equipmentTab2 = recoveryClientBaseTab["装备回收分组"]
    for equipmentName,count in pairs(counttab) do
        for i=1, #equipmentTab1  do
            if (equipmentName == equipmentTab1[i]["EquipmentName"]) then
                for j=1,#equipmentTab2 do
                    local t=NewSplitClient(equipmentTab2[j]["EquipmentLevel"],'&',5)
                    for k=1,#t do
                        if (equipmentTab1[i]["EquipmentLevel"] == tonumber(t[k])) then  
                            local equipmentgroup = equipmentTab2[j]["EquipmentGroup"]
                            CHAT(equipmentTab1[i]["EquipmentName"])
                            CHAT(counttab[equipmentTab1[i]["EquipmentName"]])

                        end

                    end             
                end
            end
        end 
   end

   return tab
end

这段代码现在是显示 背包每个物品的数量~
现在要的功能是 同组装备数量相加(统计)

1(装备表)
EquipmentId EquipmentName EquipmentLevel EquipmentType
1001 魔杖 2 1
1002 银蛇 2 1
1003 井中月 15 2
1004 龙纹剑 24 2
1005 裁决之仗 27 3
1006 屠龙刀 32 3

2(装备回收分组)
EquipmentGroup EquipmentLevel Advanced
1 1&2&3&4&5 1
2 6&7&8&9&10 1
3 11&12&13&14&15 1
4 16&17&18&19&20 1
5 21&22&23&24&25 2
6 26&27&28&29&30 2
7 31&32&33&34&35 2

1条回答 默认 最新

相关推荐 更多相似问题