Commit 1a1a6375b30324c451cd629e2dcc7b41156458d7

Authored by gaofengduan
1 parent 7e45c419

fix lua warning

src/actions/RoleAction.lua
... ... @@ -114,7 +114,6 @@ function _M.loginRpc( agent, data )
114 114 end
115 115 end
116 116 SERV_OPEN = redisproxy:hget("autoincrement_set", "server_start")
117   - local ltime = role:getProperty("ltime")
118 117  
119 118 role:changeStructVersion() -- 数据结构 版本更新
120 119  
... ...
src/models/RolePlugin.lua
... ... @@ -18,7 +18,6 @@ function RolePlugin.bind(Role)
18 18 end
19 19  
20 20 function Role:onCrossDay(now, notify)
21   - local roleId = self:getProperty("id")
22 21 local ltime = self:getProperty("ltime")
23 22  
24 23 if isCrossDay(ltime, now) then
... ... @@ -56,8 +55,6 @@ function RolePlugin.bind(Role)
56 55 end
57 56 end
58 57 end
59   - -- 其他
60   -
61 58 return count
62 59 end
63 60  
... ... @@ -76,7 +73,7 @@ function RolePlugin.bind(Role)
76 73 local itemTypeAward = {
77 74 [ItemType.Hero] = function()
78 75 pms.type = itemId - ItemStartId.Hero
79   - for i = 1, count do
  76 + for _= 1, count do
80 77 self:addHero(pms)
81 78 end
82 79 end,
... ... @@ -85,7 +82,7 @@ function RolePlugin.bind(Role)
85 82 end,
86 83 }
87 84 -- 对数量筛查
88   - local count = checkItemCount(self, itemId, count)
  85 + count = checkItemCount(self, itemId, count)
89 86 if count ~= 0 then
90 87 if itemIdAward[itemId] then
91 88 itemIdAward[itemId]()
... ... @@ -277,9 +274,7 @@ function RolePlugin.bind(Role)
277 274 function Role:addHero(params)
278 275 local roleId = self:getProperty("id")
279 276 local heroId = tonum(redisproxy:hincrby(string.format(R_INCR, roleId), "hero", 1))
280   -
281 277 local heroType = params.type
282   - local unitData = csvdb["unitCsv"][heroType]
283 278  
284 279 redisproxy:sadd(string.format(R_HEROS, roleId), heroId)
285 280  
... ... @@ -303,7 +298,7 @@ function RolePlugin.bind(Role)
303 298 end
304 299 end
305 300  
306   - function Role:delHero(params)
  301 + function Role:delHero(heroId)
307 302 local roleId = self:getProperty('id')
308 303 local hero = self.heros[heroId]
309 304 if not hero then return end
... ...
src/shared/ModelBase.lua
... ... @@ -28,7 +28,7 @@ function ModelBase:ctor(properties)
28 28  
29 29 if not self:isValidKey() then
30 30 print(string_format("%s [%s:key] should be give in new(ctor)", tostring(self), self.class.__cname))
31   - return
  31 + return
32 32 end
33 33  
34 34 if type(properties) ~= "table" then properties = {} end
... ... @@ -46,13 +46,13 @@ end
46 46  
47 47 --减少缓存引用计数 为时写入, 无参数 强制刷新所有缓存
48 48 function ModelBase:endCache( ... )
49   - args = { ... }
50   - params = {}
  49 + local args = { ... }
  50 + local params = {}
51 51  
52   - function doOneCache(field)
  52 + local function doOneCache(field)
53 53 local propname = field .. "_"
54 54 table_insert(params, field)
55   - if self.class.schema[fieldName][1] == "table" then
  55 + if self.class.schema[field][1] == "table" then
56 56 table_insert(params, MsgPack.pack(self[propname]))
57 57 else
58 58 table_insert(params, self[propname])
... ...