整理代码,调整local函数名规范(较边缘的代码不必遵守,比如外部的库和小程序):

特别临时性的用全大写字母缩写或者单字母
TASK模块用到的任务函数和检查函数开头分别为task_和check_
其他函数开头添加下划线作为指示
This commit is contained in:
MrZ626
2021-08-25 02:40:01 +08:00
parent ee55055385
commit 8f910f95f4
40 changed files with 470 additions and 466 deletions

View File

@@ -20,7 +20,7 @@ local errorAvatar=GC.DO{128,128,
{'line',10,10,117,117},
{'line',10,117,117,10},
}
local function loadAvatar(path)
local function _loadAvatar(path)
local success,img=pcall(gc.newImage,path)
if success then
local canvas=gc.newCanvas(128,128)
@@ -45,7 +45,7 @@ local db=setmetatable({},{__index=function(self,uid)
rawset(self,uid,d)
db_img[uid]=
type(d.hash)=='string'and #d.hash>0 and fs.getInfo("cache/"..d.hash)and
loadAvatar("cache/"..d.hash)or
_loadAvatar("cache/"..d.hash)or
defaultAvatar[(uid-26)%29+1]
return d
end})
@@ -63,7 +63,7 @@ function USERS.updateUserData(data)
})
if data.avatar then
fs.write("cache/"..data.hash,love.data.decode('string','base64',data.avatar:sub(data.avatar:find(",")+1)))
db_img[uid]=loadAvatar("cache/"..data.hash)
db_img[uid]=_loadAvatar("cache/"..data.hash)
db[uid].hash=type(data.hash)=='string'and #data.hash>0 and data.hash
end
end