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